home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / mac / DirectX SDK / DXSDK / include / dmusicf.h < prev    next >
C/C++ Source or Header  |  2001-10-08  |  81KB  |  2,374 lines

  1. /************************************************************************
  2. *                                                                       *
  3. *   dmusicf.h -- This module defines the DirectMusic file formats       *
  4. *                                                                       *
  5. *   Copyright (c) 1998-1999 Microsoft Corporation
  6. *                                                                       *
  7. ************************************************************************/
  8.  
  9. #ifndef _DMUSICF_
  10. #define _DMUSICF_
  11.  
  12.  
  13. #include <windows.h>
  14.  
  15. #define COM_NO_WINDOWS_H
  16. #include <objbase.h>
  17.  
  18. #include <mmsystem.h>
  19.  
  20. #include <pshpack8.h>
  21.  
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25.  
  26. interface IDirectMusicCollection;
  27. #ifndef __cplusplus 
  28. typedef interface IDirectMusicCollection IDirectMusicCollection;
  29. #endif
  30.  
  31. /* Common chunks */
  32.  
  33. #define DMUS_FOURCC_GUID_CHUNK        mmioFOURCC('g','u','i','d')
  34. #define DMUS_FOURCC_INFO_LIST         mmioFOURCC('I','N','F','O')
  35. #define DMUS_FOURCC_UNFO_LIST         mmioFOURCC('U','N','F','O')
  36. #define DMUS_FOURCC_UNAM_CHUNK        mmioFOURCC('U','N','A','M')
  37. #define DMUS_FOURCC_UART_CHUNK        mmioFOURCC('U','A','R','T')
  38. #define DMUS_FOURCC_UCOP_CHUNK        mmioFOURCC('U','C','O','P')
  39. #define DMUS_FOURCC_USBJ_CHUNK        mmioFOURCC('U','S','B','J')
  40. #define DMUS_FOURCC_UCMT_CHUNK        mmioFOURCC('U','C','M','T')
  41. #define DMUS_FOURCC_CATEGORY_CHUNK    mmioFOURCC('c','a','t','g')
  42. #define DMUS_FOURCC_VERSION_CHUNK     mmioFOURCC('v','e','r','s')
  43.  
  44. /* The following structures are used by the Tracks, and are the packed structures */
  45. /* that are passed to the Tracks inside the IStream. */
  46.  
  47.  
  48. typedef struct _DMUS_IO_SEQ_ITEM
  49. {
  50.     MUSIC_TIME    mtTime;
  51.     MUSIC_TIME    mtDuration;
  52.     DWORD         dwPChannel;
  53.     short         nOffset; 
  54.     BYTE          bStatus;
  55.     BYTE          bByte1;
  56.     BYTE          bByte2;
  57. } DMUS_IO_SEQ_ITEM;
  58.  
  59.  
  60. typedef struct _DMUS_IO_CURVE_ITEM
  61. {
  62.     MUSIC_TIME  mtStart;
  63.     MUSIC_TIME  mtDuration;
  64.     MUSIC_TIME  mtResetDuration;
  65.     DWORD       dwPChannel;
  66.     short       nOffset;
  67.     short       nStartValue;
  68.     short       nEndValue;
  69.     short       nResetValue;
  70.     BYTE        bType;
  71.     BYTE        bCurveShape;
  72.     BYTE        bCCData;
  73.     BYTE        bFlags;
  74.     /* Following was added for DX8. */
  75.     WORD        wParamType;      /* RPN or NRPN parameter number. */
  76.     WORD        wMergeIndex;     /* Allows multiple parameters to be merged (pitchbend, volume, and expression.) */
  77. } DMUS_IO_CURVE_ITEM;
  78.  
  79.  
  80. typedef struct _DMUS_IO_TEMPO_ITEM
  81. {
  82.     MUSIC_TIME    lTime;
  83.     double        dblTempo;
  84. } DMUS_IO_TEMPO_ITEM;
  85.  
  86.  
  87. typedef struct _DMUS_IO_SYSEX_ITEM
  88. {
  89.     MUSIC_TIME    mtTime;
  90.     DWORD         dwPChannel;
  91.     DWORD         dwSysExLength;
  92. } DMUS_IO_SYSEX_ITEM;
  93.  
  94. typedef DMUS_CHORD_KEY DMUS_CHORD_PARAM; /* DMUS_CHORD_KEY defined in dmusici.h */
  95.  
  96. typedef struct _DMUS_RHYTHM_PARAM
  97. {
  98.     DMUS_TIMESIGNATURE  TimeSig;
  99.     DWORD               dwRhythmPattern;
  100. } DMUS_RHYTHM_PARAM;
  101.  
  102. typedef struct _DMUS_TEMPO_PARAM
  103. {
  104.     MUSIC_TIME  mtTime;
  105.     double      dblTempo;
  106. } DMUS_TEMPO_PARAM;
  107.  
  108.  
  109. typedef struct _DMUS_MUTE_PARAM
  110. {
  111.     DWORD   dwPChannel;
  112.     DWORD   dwPChannelMap;
  113.     BOOL    fMute;
  114. } DMUS_MUTE_PARAM;
  115.  
  116. /* Style chunks */
  117.  
  118. #define DMUS_FOURCC_STYLE_FORM            mmioFOURCC('D','M','S','T')
  119. #define DMUS_FOURCC_STYLE_CHUNK           mmioFOURCC('s','t','y','h')
  120. #define DMUS_FOURCC_PART_LIST             mmioFOURCC('p','a','r','t')
  121. #define DMUS_FOURCC_PART_CHUNK            mmioFOURCC('p','r','t','h')
  122. #define DMUS_FOURCC_NOTE_CHUNK            mmioFOURCC('n','o','t','e')
  123. #define DMUS_FOURCC_CURVE_CHUNK           mmioFOURCC('c','r','v','e')
  124. #define DMUS_FOURCC_MARKER_CHUNK          mmioFOURCC('m','r','k','r')
  125. #define DMUS_FOURCC_RESOLUTION_CHUNK      mmioFOURCC('r','s','l','n')
  126. #define DMUS_FOURCC_ANTICIPATION_CHUNK    mmioFOURCC('a','n','p','n')
  127. #define DMUS_FOURCC_PATTERN_LIST          mmioFOURCC('p','t','t','n')
  128. #define DMUS_FOURCC_PATTERN_CHUNK         mmioFOURCC('p','t','n','h')
  129. #define DMUS_FOURCC_RHYTHM_CHUNK          mmioFOURCC('r','h','t','m')
  130. #define DMUS_FOURCC_PARTREF_LIST          mmioFOURCC('p','r','e','f')
  131. #define DMUS_FOURCC_PARTREF_CHUNK         mmioFOURCC('p','r','f','c')
  132. #define DMUS_FOURCC_STYLE_PERS_REF_LIST   mmioFOURCC('p','r','r','f')
  133. #define DMUS_FOURCC_MOTIFSETTINGS_CHUNK   mmioFOURCC('m','t','f','s')
  134.  
  135. /* Flags used by variations: these make up the DWORDs in dwVariationChoices.               */
  136.  
  137. /* These flags determine the types of chords supported by a given variation in DirectMusic */
  138. /* mode.  The first seven flags (bits 1-7) are set if the variation supports major chords  */
  139. /* rooted in scale positions, so, e.g., if bits 1, 2, and 4 are set, the variation         */
  140. /* supports major chords rooted in the tonic, second, and fourth scale positions.  The     */
  141. /* next seven flags serve the same purpose, but for minor chords, and the following seven  */
  142. /* flags serve the same purpose for chords that are not major or minor (e.g., SUS 4        */
  143. /* chords).  Bits 22, 23, and 24 are set if the variation supports chords rooted in the    */
  144. /* scale, chords rooted sharp of scale tones, and chords rooted flat of scale tones,       */
  145. /* respectively.  For example, to support a C# minor chord in the scale of C Major,        */
  146. /* bits 8 (for tonic minor) and 24 (for sharp) need to be set.  Bits 25, 26, an 27 handle  */
  147. /* chords that are triads, 6th or 7th chords, and chords with extensions, respectively.    */
  148. /* bits 28 and 29 handle chords that are followed by tonic and dominant chords,            */
  149. /* respectively.                                                                           */
  150. #define DMUS_VARIATIONF_MAJOR        0x0000007F /* Seven positions in the scale - major chords. */    
  151. #define DMUS_VARIATIONF_MINOR        0x00003F80 /* Seven positions in the scale - minor chords. */    
  152. #define DMUS_VARIATIONF_OTHER        0x001FC000 /* Seven positions in the scale - other chords. */    
  153. #define DMUS_VARIATIONF_ROOT_SCALE   0x00200000 /* Handles chord roots in the scale. */         
  154. #define DMUS_VARIATIONF_ROOT_FLAT    0x00400000 /* Handles flat chord roots (based on scale notes). */         
  155. #define DMUS_VARIATIONF_ROOT_SHARP   0x00800000 /* Handles sharp chord roots (based on scale notes). */         
  156. #define DMUS_VARIATIONF_TYPE_TRIAD   0x01000000 /* Handles simple chords - triads. */  
  157. #define DMUS_VARIATIONF_TYPE_6AND7   0x02000000 /* Handles simple chords - 6 and 7. */  
  158. #define DMUS_VARIATIONF_TYPE_COMPLEX 0x04000000 /* Handles complex chords. */  
  159. #define DMUS_VARIATIONF_DEST_TO1     0x08000000 /* Handles transitions to 1 chord. */  
  160. #define DMUS_VARIATIONF_DEST_TO5     0x10000000 /* Handles transitions to 5 chord. */  
  161. #define DMUS_VARIATIONF_DEST_OTHER   0x40000000 /* Handles transitions to chords other than 1 . */  
  162.  
  163. /* legacy mask for variation modes */
  164. #define DMUS_VARIATIONF_MODES        0xE0000000
  165. /* Bits 29 and 31 of the variation flags are the Mode bits.  If both are 0, it's IMA. */  
  166. /* If bit 29 is 1, it's Direct Music. */
  167. #define DMUS_VARIATIONF_MODES_EX     (0x20000000 | 0x80000000)
  168. #define DMUS_VARIATIONF_IMA25_MODE   0x00000000
  169. #define DMUS_VARIATIONF_DMUS_MODE    0x20000000
  170.  
  171. /* Set this if the part uses marker events */
  172. #define DMUS_PARTF_USE_MARKERS       0x1
  173. /* Set this if the part is allowed to switch only on chord-aligned markers */
  174. #define DMUS_PARTF_ALIGN_CHORDS      0x2
  175.  
  176. /* These specify if the marker event signals whether to stop a variation or start a 
  177. pattern/variation (or both), and whether new variations must align with a chord */
  178. #define DMUS_MARKERF_START            0x1
  179. #define DMUS_MARKERF_STOP             0x2
  180. #define DMUS_MARKERF_CHORD_ALIGN      0x4
  181.  
  182. /* if this flag is set, variation settings in a playing pattern-based track's state data will 
  183. persist in the track after it stops playing */
  184. #define DMUS_PATTERNF_PERSIST_CONTROL 0x1
  185.  
  186. /* These specify possible values for DMUS_IO_PARTREF.bRandomVariation
  187.    all but DMUS_VARIATIONT_SEQUENTIAL and DMUS_VARIATIONT_RANDOM are dx8. */
  188. typedef enum enumDMUS_VARIATIONT_TYPES
  189. {
  190.     DMUS_VARIATIONT_SEQUENTIAL       = 0, /* Play sequential starting with variation 1. */
  191.     DMUS_VARIATIONT_RANDOM           = 1, /* Play randomly. */
  192.     DMUS_VARIATIONT_RANDOM_START     = 2, /* Play sequential starting with a random variation. */
  193.     DMUS_VARIATIONT_NO_REPEAT        = 3, /* Play randomly, but don't play the same variation twice. */
  194.     DMUS_VARIATIONT_RANDOM_ROW       = 4  /* Play randomly as a row: don't repeat any variation until all have played. */
  195. } DMUS_VARIATIONT_TYPES;
  196.  
  197. #pragma pack(2)
  198.  
  199. typedef struct _DMUS_IO_TIMESIG
  200. {
  201.     /* Time signatures define how many beats per measure, which note receives */
  202.     /* the beat, and the grid resolution. */
  203.     BYTE    bBeatsPerMeasure;   /* beats per measure (top of time sig) */
  204.     BYTE    bBeat;              /* what note receives the beat (bottom of time sig.) */
  205.                                 /* we can assume that 0 means 256th note */
  206.     WORD    wGridsPerBeat;      /* grids per beat */
  207. } DMUS_IO_TIMESIG;
  208.  
  209. typedef struct _DMUS_IO_STYLE
  210. {
  211.     DMUS_IO_TIMESIG     timeSig;        /* Styles have a default Time Signature */
  212.     double              dblTempo;   
  213. } DMUS_IO_STYLE;
  214.  
  215. typedef struct _DMUS_IO_VERSION
  216. {
  217.     DWORD               dwVersionMS;        /* Version # high-order 32 bits */
  218.     DWORD               dwVersionLS;        /* Version # low-order 32 bits  */
  219. } DMUS_IO_VERSION;
  220.  
  221. typedef struct _DMUS_IO_PATTERN
  222. {
  223.     DMUS_IO_TIMESIG     timeSig;           /* Patterns can override the Style's Time sig. */
  224.     BYTE                bGrooveBottom;     /* bottom of groove range */
  225.     BYTE                bGrooveTop;        /* top of groove range */
  226.     WORD                wEmbellishment;    /* Fill, Break, Intro, End, Normal, Motif */
  227.     WORD                wNbrMeasures;      /* length in measures */
  228.     BYTE                bDestGrooveBottom; /* bottom of groove range for next pattern */
  229.     BYTE                bDestGrooveTop;    /* top of groove range for next pattern */
  230.     DWORD               dwFlags;           /* various flags */
  231. } DMUS_IO_PATTERN;
  232.  
  233. typedef struct _DMUS_IO_STYLEPART
  234. {
  235.     DMUS_IO_TIMESIG     timeSig;        /* can override pattern's */
  236.     DWORD               dwVariationChoices[32]; /* MOAW choice bitfield */
  237.     GUID                guidPartID;     /* identifies the part */
  238.     WORD                wNbrMeasures;   /* length of the Part */
  239.     BYTE                bPlayModeFlags; /* see PLAYMODE flags */
  240.     BYTE                bInvertUpper;   /* inversion upper limit */
  241.     BYTE                bInvertLower;   /* inversion lower limit */
  242.     BYTE                bPad[3];        /* for DWORD alignment */
  243.     DWORD               dwFlags;        /* various flags */ 
  244. } DMUS_IO_STYLEPART;
  245.  
  246. typedef struct _DMUS_IO_PARTREF
  247. {
  248.     GUID    guidPartID;         /* unique ID for matching up with parts */
  249.     WORD    wLogicalPartID;     /* corresponds to port/device/midi channel OBSOLETE */
  250.     BYTE    bVariationLockID;   /* parts with the same ID lock variations. */
  251.                                 /* high bit is used to identify master Part */
  252.     BYTE    bSubChordLevel;     /* tells which sub chord level this part wants */
  253.     BYTE    bPriority;          /* 256 priority levels. Parts with lower priority */
  254.                                 /* aren't played first when a device runs out of */
  255.                                 /* notes */
  256.     BYTE    bRandomVariation;   /* when set, matching variations play in random order */
  257.                                 /* when clear, matching variations play sequentially */
  258.     WORD    wPad;               /* not used */
  259.     DWORD   dwPChannel;         /* replaces wLogicalPartID */
  260. } DMUS_IO_PARTREF;
  261.  
  262. typedef struct _DMUS_IO_STYLENOTE
  263. {
  264.     MUSIC_TIME  mtGridStart;    /* when this note occurs */
  265.     DWORD       dwVariation;    /* variation bits */
  266.     MUSIC_TIME  mtDuration;     /* how long this note lasts */
  267.     short       nTimeOffset;    /* offset from mtGridStart */
  268.     WORD        wMusicValue;    /* Position in scale. */
  269.     BYTE        bVelocity;      /* Note velocity. */
  270.     BYTE        bTimeRange;     /* Range to randomize start time. */
  271.     BYTE        bDurRange;      /* Range to randomize duration. */
  272.     BYTE        bVelRange;      /* Range to randomize velocity. */
  273.     BYTE        bInversionID;   /* Identifies inversion group to which this note belongs */
  274.     BYTE        bPlayModeFlags; /* Can override part */
  275.     /* Following exists only under DX8 and on */
  276.     BYTE        bNoteFlags;     /* values from DMUS_NOTEF_FLAGS */
  277. } DMUS_IO_STYLENOTE;
  278.  
  279. typedef struct _DMUS_IO_STYLECURVE
  280. {
  281.     MUSIC_TIME  mtGridStart;    /* when this curve occurs */
  282.     DWORD       dwVariation;    /* variation bits */
  283.     MUSIC_TIME  mtDuration;     /* how long this curve lasts */
  284.     MUSIC_TIME  mtResetDuration;/* how long after the end of the curve to reset the curve */
  285.     short       nTimeOffset;    /* offset from mtGridStart */
  286.     short       nStartValue;    /* curve's start value */
  287.     short       nEndValue;      /* curve's end value */
  288.     short       nResetValue;    /* the value to which to reset the curve */
  289.     BYTE        bEventType;     /* type of curve */
  290.     BYTE        bCurveShape;    /* shape of curve */
  291.     BYTE        bCCData;        /* CC# */
  292.     BYTE        bFlags;         /* Bit 1=TRUE means to send nResetValue. Otherwise, don't.
  293.                                    Other bits are reserved. */
  294.     /*  Following was added for DX8. */
  295.     WORD        wParamType;      /* RPN or NRPN parameter number. */
  296.     WORD        wMergeIndex;     /* Allows multiple parameters to be merged (pitchbend, volume, and expression.) */
  297. } DMUS_IO_STYLECURVE;
  298.  
  299. typedef struct _DMUS_IO_STYLEMARKER
  300. {
  301.     MUSIC_TIME  mtGridStart;    /* when this marker occurs */
  302.     DWORD       dwVariation;    /* variation bits */
  303.     WORD        wMarkerFlags;   /* how the marker is used */
  304. } DMUS_IO_STYLEMARKER;
  305.  
  306. typedef struct _DMUS_IO_STYLERESOLUTION
  307. {
  308.     DWORD    dwVariation;       /* variation bits */
  309.     WORD     wMusicValue;       /* Position in scale. */
  310.     BYTE     bInversionID;      /* Identifies inversion group to which this note belongs */
  311.     BYTE     bPlayModeFlags;    /* Can override part */
  312. } DMUS_IO_STYLERESOLUTION;
  313.  
  314. typedef struct _DMUS_IO_STYLE_ANTICIPATION
  315. {
  316.     MUSIC_TIME    mtGridStart;   /* when this anticipation occurs */
  317.     DWORD         dwVariation;   /* variation bits */
  318.     short         nTimeOffset;   /* offset from mtGridStart */
  319.     BYTE          bTimeRange;    /* Range to randomize start time. */
  320. } DMUS_IO_STYLE_ANTICIPATION;
  321.  
  322. typedef struct _DMUS_IO_MOTIFSETTINGS
  323. {
  324.     DWORD       dwRepeats;      /* Number of repeats. By default, 0. */
  325.     MUSIC_TIME  mtPlayStart;    /* Start of playback. By default, 0. */
  326.     MUSIC_TIME  mtLoopStart;    /* Start of looping portion. By default, 0. */
  327.     MUSIC_TIME  mtLoopEnd;      /* End of loop. Must be greater than mtLoopStart. Or, 0, indicating loop full motif.  */
  328.     DWORD       dwResolution;   /* Default resolution. */
  329. } DMUS_IO_MOTIFSETTINGS;
  330.  
  331. #pragma pack()
  332.  
  333.  
  334. /*
  335. RIFF
  336. (
  337.     'DMST'          // Style
  338.     <styh-ck>       // Style header chunk
  339.     <guid-ck>       // Every Style has a GUID
  340.     [<UNFO-list>]   // Name, author, copyright info., comments
  341.     [<vers-ck>]     // version chunk
  342.     <part-list>...  // Array of parts in the Style, used by patterns
  343.     <pttn-list>...  // Array of patterns in the Style
  344.     <DMBD-form>...  // Array of bands in the Style
  345.     [<prrf-list>]...// Optional array of chord map references in the Style
  346. )
  347.  
  348.     // <styh-ck>
  349.     styh
  350.     (
  351.         <DMUS_IO_STYLE>
  352.     )
  353.  
  354.     // <guid-ck>
  355.     guid
  356.     (
  357.         <GUID>
  358.     )
  359.  
  360.     // <vers-ck>
  361.     vers
  362.     (
  363.         <DMUS_IO_VERSION>
  364.     )
  365.  
  366.     // <part-list>
  367.     LIST
  368.     (
  369.         'part'
  370.         <prth-ck>       // Part header chunk
  371.         [<UNFO-list>]   // Name, author, copyright info., comments
  372.         [<note-ck>]     // Optional chunk containing an array of notes in Part
  373.         [<crve-ck>]     // Optional chunk containing an array of curves in Part
  374.         [<mrkr-ck>]     // Optional chunk containing an array of markers in Part
  375.         [<rsln-ck>]     // Optional chunk containing an array of variation resolutions in Part
  376.         [<anpn-ck>]     // Optional chunk containing an array of resolution anticipations in Part
  377.     )
  378.  
  379.         // <orth-ck>
  380.         prth
  381.         (
  382.             <DMUS_IO_STYLEPART>
  383.         )
  384.  
  385.         // <note-ck>
  386.         'note'
  387.         (
  388.             // sizeof DMUS_IO_STYLENOTE:DWORD
  389.             <DMUS_IO_STYLENOTE>...
  390.         )
  391.  
  392.         // <crve-ck>
  393.         'crve'
  394.         (
  395.             // sizeof DMUS_IO_STYLECURVE:DWORD
  396.             <DMUS_IO_STYLECURVE>...
  397.         )
  398.  
  399.         // <mrkr-ck>
  400.         'mrkr'
  401.         (
  402.             // sizeof DMUS_IO_STYLEMARKER:DWORD
  403.             <DMUS_IO_STYLEMARKER>...
  404.         )
  405.  
  406.         // <rsln-ck>
  407.         'rsln'
  408.         (
  409.             // sizeof DMUS_IO_STYLERESOLUTION:DWORD
  410.             <DMUS_IO_STYLERESOLUTION>...
  411.         )
  412.  
  413.         // <anpn-ck>
  414.         'anpn'
  415.         (
  416.             // sizeof DMUS_IO_STYLE_ANTICIPATION:DWORD
  417.             <DMUS_IO_STYLE_ANTICIPATION>...
  418.         )
  419.  
  420.     // <pttn-list>
  421.     LIST
  422.     (
  423.         'pttn'
  424.         <ptnh-ck>       // Pattern header chunk
  425.         <rhtm-ck>       // Chunk containing an array of rhythms for chord matching
  426.         [<UNFO-list>]   // Name, author, copyright info., comments
  427.         [<mtfs-ck>]     // Motif settings chunk
  428.         [<DMBD-form>]   // Optional band to be associated with the pattern (for motifs)
  429.         <pref-list>...  // Array of part reference id's
  430.     )
  431.  
  432.         // <ptnh-ck>
  433.         ptnh
  434.         (
  435.             <DMUS_IO_PATTERN>
  436.         )
  437.  
  438.         // <rhtm-ck>
  439.         'rhtm'
  440.         (
  441.             // DWORD's representing rhythms for chord matching based on number
  442.             // of measures in the pattern
  443.         )
  444.  
  445.  
  446.         // pref-list
  447.         LIST
  448.         (
  449.             'pref'
  450.             <prfc-ck>   // part ref chunk
  451.         )
  452.  
  453.         // <prfc-ck>
  454.         prfc
  455.         (
  456.             <DMUS_IO_PARTREF>
  457.         )
  458.  
  459.         // <mtfs-ck>
  460.         mtfs
  461.         (
  462.             <DMUS_IO_MOTIFSETTINGS>
  463.         )
  464.  
  465.     // <prrf-list>
  466.     LIST
  467.     (
  468.         'prrf'
  469.         <DMRF-list>... // Array of Chordmap references
  470.     )
  471. */
  472.  
  473. /* Pattern chunk, for use in Pattern tracks */
  474.  
  475. #define DMUS_FOURCC_PATTERN_FORM        mmioFOURCC('D','M','P','T')
  476.  
  477. /*
  478. RIFF
  479. (
  480.     'DMPT'          // Pattern
  481.     <styh-ck>       // Style header chunk
  482.     <pttn-list>     // The pattern, in single pattern format (includes DMUS_FOURCC_PART_LIST chunks)
  483. )
  484. */
  485.  
  486.  
  487. /* Chord and command file formats */
  488.  
  489. /* These specify possible values for DMUS_IO_COMMAND.bRepeatMode (dx8) */
  490. typedef enum enumDMUS_PATTERNT_TYPES
  491. {
  492.     DMUS_PATTERNT_RANDOM           = 0, /* Play randomly. (dx7 behavior) */
  493.     DMUS_PATTERNT_REPEAT           = 1, /* Repeat last pattern. */
  494.     DMUS_PATTERNT_SEQUENTIAL       = 2, /* Play sequential starting with first matching pattern. */
  495.     DMUS_PATTERNT_RANDOM_START     = 3, /* Play sequential starting with a random pattern. */
  496.     DMUS_PATTERNT_NO_REPEAT        = 4, /* Play randomly, but don't play the same pattern twice. */
  497.     DMUS_PATTERNT_RANDOM_ROW       = 5  /* Play randomly as a row: don't repeat any pattern until all have played. */
  498. } DMUS_PATTERNT_TYPES;
  499.  
  500. #define DMUS_FOURCC_CHORDTRACK_LIST         mmioFOURCC('c','o','r','d')
  501. #define DMUS_FOURCC_CHORDTRACKHEADER_CHUNK  mmioFOURCC('c','r','d','h')
  502. #define DMUS_FOURCC_CHORDTRACKBODY_CHUNK    mmioFOURCC('c','r','d','b')
  503.  
  504. #define DMUS_FOURCC_COMMANDTRACK_CHUNK      mmioFOURCC('c','m','n','d')
  505.  
  506. typedef struct _DMUS_IO_CHORD
  507. {
  508.     WCHAR       wszName[16];    /* Name of the chord */
  509.     MUSIC_TIME  mtTime;         /* Time of this chord */
  510.     WORD        wMeasure;       /* Measure this falls on */
  511.     BYTE        bBeat;          /* Beat this falls on */
  512.     BYTE        bFlags;         /* Various flags */
  513. } DMUS_IO_CHORD;
  514.  
  515. typedef struct _DMUS_IO_SUBCHORD
  516. {
  517.     DWORD   dwChordPattern;     /* Notes in the subchord */
  518.     DWORD   dwScalePattern;     /* Notes in the scale */
  519.     DWORD   dwInversionPoints;  /* Where inversions can occur */
  520.     DWORD   dwLevels;           /* Which levels are supported by this subchord */
  521.     BYTE    bChordRoot;         /* Root of the subchord */
  522.     BYTE    bScaleRoot;         /* Root of the scale */
  523. } DMUS_IO_SUBCHORD;
  524.  
  525. typedef struct _DMUS_IO_COMMAND
  526. {
  527.     MUSIC_TIME  mtTime;         /* Time of this command */
  528.     WORD        wMeasure;       /* Measure this falls on */
  529.     BYTE        bBeat;          /* Beat this falls on */
  530.     BYTE        bCommand;       /* Command type (see #defines below) */
  531.     BYTE        bGrooveLevel;   /* Groove level (0 if command is not a groove) */
  532.     BYTE        bGrooveRange;   /* Groove range  */
  533.     BYTE        bRepeatMode;    /* Used to control selection of patterns with same groove level  */
  534. } DMUS_IO_COMMAND;
  535.  
  536.  
  537. /*
  538.  
  539.     // <cord-list>
  540.     LIST
  541.     (
  542.         'cord'
  543.         <crdh-ck>
  544.         <crdb-ck>       // Chord body chunk
  545.     )
  546.  
  547.         // <crdh-ck>
  548.         crdh
  549.         (
  550.             // Scale: dword (upper 8 bits for root, lower 24 for scale)
  551.         )
  552.  
  553.         // <crdb-ck>
  554.         crdb
  555.         (
  556.             // sizeof DMUS_IO_CHORD:dword
  557.             <DMUS_IO_CHORD>
  558.             // # of DMUS_IO_SUBCHORDS:dword
  559.             // sizeof DMUS_IO_SUBCHORDS:dword
  560.             // a number of <DMUS_IO_SUBCHORD>
  561.         )
  562.  
  563.  
  564.     // <cmnd-list>
  565.     'cmnd'
  566.     (
  567.         //sizeof DMUS_IO_COMMAND: DWORD
  568.         <DMUS_IO_COMMAND>...
  569.     )
  570.  
  571. */
  572.  
  573. /*  File io for DirectMusic Tool and ToolGraph objects
  574. */
  575.  
  576. /* RIFF ids: */
  577.  
  578. #define DMUS_FOURCC_TOOLGRAPH_FORM  mmioFOURCC('D','M','T','G')
  579. #define DMUS_FOURCC_TOOL_LIST       mmioFOURCC('t','o','l','l')
  580. #define DMUS_FOURCC_TOOL_FORM       mmioFOURCC('D','M','T','L')
  581. #define DMUS_FOURCC_TOOL_CHUNK      mmioFOURCC('t','o','l','h')
  582.  
  583. /* io structures: */
  584.  
  585. typedef struct _DMUS_IO_TOOL_HEADER
  586. {
  587.     GUID        guidClassID;    /* Class id of tool. */
  588.     long        lIndex;         /* Position in graph. */
  589.     DWORD       cPChannels;     /* Number of items in channels array. */
  590.     FOURCC      ckid;           /* chunk ID of tool's data chunk if 0 fccType valid. */
  591.     FOURCC      fccType;        /* list type if NULL ckid valid. */
  592.     DWORD       dwPChannels[1]; /* Array of PChannels, size determined by cPChannels. */
  593. } DMUS_IO_TOOL_HEADER;
  594.  
  595. /*
  596. RIFF
  597. (
  598.     'DMTG'          // DirectMusic ToolGraph chunk
  599.     [<guid-ck>]     // GUID for ToolGraph
  600.     [<vers-ck>]     // Optional version info
  601.     [<UNFO-list>]   // Name, author, copyright info., comments
  602.     <toll-list>     // List of Tools
  603. )
  604.  
  605.     // <guid-ck>
  606.     'guid'
  607.     (
  608.         <GUID>
  609.     )
  610.  
  611.     // <vers-ck>
  612.     vers
  613.     (
  614.         <DMUS_IO_VERSION>
  615.     )
  616.  
  617.     // <toll-list>
  618.     LIST
  619.     (
  620.         'toll'          // Array of tools
  621.         <DMTL-form>...  // Each tool is encapsulated in a RIFF chunk
  622.     )
  623.  
  624. // <DMTL-form>      Tools are embedded in a graph. Theoretically, they can be saved as individual files too.
  625. RIFF
  626. (
  627.     'DMTL'
  628.     <tolh-ck>
  629.     [<data>]        // Tool data. Must be a RIFF readable chunk.
  630. )
  631.  
  632.     // <tolh-ck>            // Tool header chunk
  633.     (
  634.         'tolh'
  635.         <DMUS_IO_TOOL_HEADER>   // Tool header
  636.     )
  637. */
  638.  
  639. /*  The AudioPath file carries everything for describing a specific audio path,
  640.     including Tool Graph and Buffer Descriptor.
  641.     This can even be used for configuring a complete performance.
  642. */
  643.  
  644. #define DMUS_FOURCC_AUDIOPATH_FORM  mmioFOURCC('D','M','A','P')
  645.  
  646. /*
  647. RIFF
  648. (
  649.     'DMAP'          // DirectMusic AudioPath chunk
  650.     [<guid-ck>]     // GUID for this Audio Path configuration
  651.     [<vers-ck>]     // Optional version info
  652.     [<UNFO-list>]   // Name, author, copyright info., comments
  653.     [<DMTG-form>]   // Optional ToolGraph
  654.     [<pcsl-list>]   // Optional list of port configurations
  655.     [<dbfl-list>]...// Optional array of Dsound buffer descriptors
  656. )
  657. */
  658.  
  659. #define DMUS_FOURCC_PORTCONFIGS_LIST    mmioFOURCC('p','c','s','l')
  660. #define DMUS_FOURCC_PORTCONFIG_LIST     mmioFOURCC('p','c','f','l')
  661. #define DMUS_FOURCC_PORTCONFIG_ITEM     mmioFOURCC('p','c','f','h')
  662. #define DMUS_FOURCC_PORTPARAMS_ITEM     mmioFOURCC('p','p','r','h')
  663. #define DMUS_FOURCC_DSBUFFER_LIST       mmioFOURCC('d','b','f','l')
  664. #define DMUS_FOURCC_DSBUFFATTR_ITEM     mmioFOURCC('d','d','a','h')
  665. #define DMUS_FOURCC_PCHANNELS_LIST      mmioFOURCC('p','c','h','l')
  666. #define DMUS_FOURCC_PCHANNELS_ITEM      mmioFOURCC('p','c','h','h')
  667.  
  668. typedef struct _DMUS_IO_PORTCONFIG_HEADER
  669. {
  670.     GUID    guidPort;           /* GUID of requested port. */
  671.     DWORD   dwPChannelBase;     /* PChannel that this should start on. */
  672.     DWORD   dwPChannelCount;    /* How many channels. */
  673.     DWORD   dwFlags;            /* Various flags. */
  674. } DMUS_IO_PORTCONFIG_HEADER;
  675.  
  676. #define DMUS_PORTCONFIGF_DRUMSON10  1   /* This port configured for drums on channel 10. */
  677. #define DMUS_PORTCONFIGF_USEDEFAULT 2   /* Use the default port. */
  678.  
  679. /* Each portconfig has one or more pchannel to buffer mappings. Each buffer
  680.    is identified by a guid. Each pchannel can map to one or more buffers.
  681.    This is defined with one or more DMUS_IO_PCHANNELTOBUFFER_HEADER
  682.    structures. Each defines a range of PChannels and the set of buffers
  683.    that they connect to. 
  684. */
  685.  
  686. typedef struct _DMUS_IO_PCHANNELTOBUFFER_HEADER
  687. {
  688.     DWORD   dwPChannelBase;     /* PChannel that this should start on. */
  689.     DWORD   dwPChannelCount;    /* How many PChannels. */
  690.     DWORD   dwBufferCount;      /* How many buffers do these connect to. */
  691.     DWORD   dwFlags;            /* Various flags. Currently reserved for future use. Must be 0. */
  692. } DMUS_IO_PCHANNELTOBUFFER_HEADER;
  693.  
  694. /* Each buffer is represented by an DSBC form. This is wrapped by the 
  695.    DMUS_IO_BUFFER_ATTRIBUTES_HEADER which identifies how to use the
  696.    buffer. In particular, it indicates whether this gets dynamically duplicated
  697.    or all references to this should share the same instance. 
  698.    To resolve references, the unique GUID of the buffer is also stored
  699.    in this structure. 
  700. */
  701.    
  702. typedef struct _DMUS_IO_BUFFER_ATTRIBUTES_HEADER
  703. {
  704.     GUID    guidBufferID;       /* Each buffer config has a unique ID. */
  705.     DWORD   dwFlags;            /* Various flags. */
  706. } DMUS_IO_BUFFER_ATTRIBUTES_HEADER;
  707.  
  708. /* DMUS_IO_BUFFER_ATTRIBUTES_HEADER.dwFlags: */
  709. #define DMUS_BUFFERF_SHARED     1   /* Share this with other audio paths, instead of creating unique copies. */
  710. #define DMUS_BUFFERF_DEFINED    2   /* Use one of the standard predefined buffers (see GUID_Buffer... in dmusici.h.) */
  711. #define DMUS_BUFFERF_MIXIN      8   /* This is a mixin buffer. */
  712.  
  713. /*
  714.  
  715. LIST
  716. (
  717.     'pcsl'          // Array of port configurations
  718.     <pcfl-list>...  // One or more port configurations, each in a list chunk
  719. )
  720.  
  721. LIST
  722. (
  723.     'pcfl'          // List container for one port configuration.
  724.     <pcfh-ck>       // Portconfig header chunk.
  725.     <pprh-ck>       // Port params, to be used to create the port.
  726.     [<dbfl-list>]...// Optional array of Dsound buffer descriptors
  727.     [<pchl-list>]   // Optional list of pchannel to buffer assignments
  728.  
  729. )
  730.  
  731.     // <pcfh-ck>            // Port config header chunk
  732.     (
  733.         'pcfh'
  734.         <DMUS_IO_PORTCONFIG_HEADER>   // Port config header
  735.     )
  736.  
  737.     // <pprh-ck>            // Port params header chunk
  738.     (
  739.         'pprh'
  740.         <DMUS_PORTPARAMS8>   // Port params header
  741.     )
  742.  
  743. LIST
  744. (
  745.     'pchl'          // List container for one or more pchannel to buffer assignments.
  746.     <pchh-ck>...    // One or more pchannel to buffer assignment headers and data.
  747.  
  748.     // <pchh-ck>
  749.     (
  750.         'pchh'
  751.         <DMUS_IO_PCHANNELTOBUFFER_HEADER>   // Description of PChannels
  752.         <GUID>...                           // Array of GUIDs defining the buffers they all connect to.
  753.     )
  754. )
  755.  
  756. LIST
  757. (
  758.     'dbfl'          // List container for one buffer and buffer attributes header.
  759.     <ddah-ck>       // Buffer attributes header. 
  760.     [<DSBC-form>]   // Buffer configuration. Not required when header uses a predefined buffer type.
  761.  
  762.     // <ddah-ck>
  763.     (
  764.         'ddah'
  765.         <DMUS_IO_BUFFER_ATTRIBUTES_HEADER>   // Buffer attributes.
  766.     )
  767. )
  768. */
  769.  
  770. /*  File io for DirectMusic Band Track object */
  771.  
  772.  
  773. /* RIFF ids: */
  774. #define DMUS_FOURCC_BANDTRACK_FORM  mmioFOURCC('D','M','B','T')
  775. #define DMUS_FOURCC_BANDTRACK_CHUNK mmioFOURCC('b','d','t','h')
  776. #define DMUS_FOURCC_BANDS_LIST      mmioFOURCC('l','b','d','l')
  777. #define DMUS_FOURCC_BAND_LIST       mmioFOURCC('l','b','n','d')
  778. #define DMUS_FOURCC_BANDITEM_CHUNK  mmioFOURCC('b','d','i','h')
  779. #define DMUS_FOURCC_BANDITEM_CHUNK2 mmioFOURCC('b','d','2','h')
  780.  
  781. /* io structures */
  782. typedef struct _DMUS_IO_BAND_TRACK_HEADER
  783. {
  784.     BOOL bAutoDownload;     /* Determines if Auto-Download is enabled. */
  785. } DMUS_IO_BAND_TRACK_HEADER;
  786.  
  787. typedef struct _DMUS_IO_BAND_ITEM_HEADER
  788. {
  789.     MUSIC_TIME lBandTime;   /* Position in track list. */
  790. } DMUS_IO_BAND_ITEM_HEADER;
  791.  
  792. typedef struct _DMUS_IO_BAND_ITEM_HEADER2
  793. {
  794.     MUSIC_TIME lBandTimeLogical;   /* Position in track list. Time in the music with which band change is associated. */
  795.     MUSIC_TIME lBandTimePhysical;  /* Precise time band change will take effect. Should be close to logical time. */
  796. } DMUS_IO_BAND_ITEM_HEADER2;
  797.  
  798. /*
  799. RIFF
  800. (
  801.     'DMBT'          // DirectMusic Band Track form-type
  802.     [<bdth-ck>]     // Band track header
  803.     [<guid-ck>]     // GUID for band track
  804.     [<vers-ck>]     // Optional version info
  805.     [<UNFO-list>]   // Name, author, copyright info., comments
  806.     <lbdl-list>     // List of Band items
  807. )
  808.  
  809.     // <bnth-ck>
  810.     'bdth'
  811.     (
  812.         <DMUS_IO_BAND_TRACK_HEADER>
  813.     )
  814.  
  815.     // <guid-ck>
  816.     'guid'
  817.     (
  818.         <GUID>
  819.     )
  820.  
  821.     // <vers-ck>
  822.     vers
  823.     (
  824.         <DMUS_IO_VERSION>
  825.     )
  826.  
  827.     // <lbdl-list>
  828.     LIST
  829.     (
  830.         'lbdl'
  831.         <lbnd-list>...  // Array of bands, each encapsulated in a list chunk
  832.     )
  833.  
  834.         // <lbnd-list>
  835.         LIST
  836.         (
  837.             'lbnd'
  838.             <bdih-ck> or <bd2h-ck>  // bdih is a legacy format.  bd2h is preferred for new content.
  839.             <DMBD-form> // Band
  840.         )
  841.  
  842.             // <bdih-ck> or <bd2h-ck>       // band item header
  843.             (
  844.                 <DMUS_IO_BAND_ITEM_HEADER> or <DMUS_IO_BAND_ITEM_HEADER2> // Band item header
  845.             )
  846. */      
  847.  
  848.  
  849. /*  File io for DirectMusic Band object
  850. */
  851.  
  852. /* RIFF ids: */
  853.  
  854. #define DMUS_FOURCC_BAND_FORM           mmioFOURCC('D','M','B','D')
  855. #define DMUS_FOURCC_INSTRUMENTS_LIST    mmioFOURCC('l','b','i','l')
  856. #define DMUS_FOURCC_INSTRUMENT_LIST     mmioFOURCC('l','b','i','n')
  857. #define DMUS_FOURCC_INSTRUMENT_CHUNK    mmioFOURCC('b','i','n','s')
  858.  
  859. /* Flags for DMUS_IO_INSTRUMENT
  860.  */
  861. #define DMUS_IO_INST_PATCH          (1 << 0)        /* dwPatch is valid. */
  862. #define DMUS_IO_INST_BANKSELECT     (1 << 1)        /* dwPatch contains a valid Bank Select MSB and LSB part */
  863. #define DMUS_IO_INST_ASSIGN_PATCH   (1 << 3)        /* dwAssignPatch is valid */
  864. #define DMUS_IO_INST_NOTERANGES     (1 << 4)        /* dwNoteRanges is valid */
  865. #define DMUS_IO_INST_PAN            (1 << 5)        /* bPan is valid */
  866. #define DMUS_IO_INST_VOLUME         (1 << 6 )       /* bVolume is valid */
  867. #define DMUS_IO_INST_TRANSPOSE      (1 << 7)        /* nTranspose is valid */
  868. #define DMUS_IO_INST_GM             (1 << 8)        /* Instrument is from GM collection */
  869. #define DMUS_IO_INST_GS             (1 << 9)        /* Instrument is from GS collection */
  870. #define DMUS_IO_INST_XG             (1 << 10)       /* Instrument is from XG collection */
  871. #define DMUS_IO_INST_CHANNEL_PRIORITY (1 << 11)     /* dwChannelPriority is valid */
  872. #define DMUS_IO_INST_USE_DEFAULT_GM_SET (1 << 12)   /* Always use the default GM set for this patch,  */
  873.                                                     /* don't rely on the synth caps stating GM or GS in hardware. */
  874. #define DMUS_IO_INST_PITCHBENDRANGE (1 << 13)     /* nPitchBendRange is valid */
  875.  
  876. /* io structures */
  877. typedef struct _DMUS_IO_INSTRUMENT
  878. {
  879.     DWORD   dwPatch;            /* MSB, LSB and Program change to define instrument */
  880.     DWORD   dwAssignPatch;      /* MSB, LSB and Program change to assign to instrument when downloading */
  881.     DWORD   dwNoteRanges[4];    /* 128 bits; one for each MIDI note instrument needs to able to play */
  882.     DWORD   dwPChannel;         /* PChannel instrument plays on */
  883.     DWORD   dwFlags;            /* DMUS_IO_INST_ flags */
  884.     BYTE    bPan;               /* Pan for instrument */
  885.     BYTE    bVolume;            /* Volume for instrument */
  886.     short   nTranspose;         /* Number of semitones to transpose notes */
  887.     DWORD   dwChannelPriority;  /* Channel priority */
  888.     short   nPitchBendRange;    /* Number of semitones shifted by pitch bend */
  889. } DMUS_IO_INSTRUMENT;
  890.  
  891. /*
  892. // <DMBD-form> bands can be embedded in other forms
  893. RIFF
  894. (
  895.     'DMBD'          // DirectMusic Band chunk
  896.     [<guid-ck>]     // GUID for band
  897.     [<vers-ck>]     // Optional version info
  898.     [<UNFO-list>]   // Name, author, copyright info., comments
  899.     <lbil-list>     // List of Instruments
  900. )
  901.  
  902.     // <guid-ck>
  903.     'guid'
  904.     (
  905.         <GUID>
  906.     )
  907.  
  908.     // <vers-ck>
  909.     vers
  910.     (
  911.         <DMUS_IO_VERSION>
  912.     )
  913.  
  914.     // <lbil-list>
  915.     LIST
  916.     (
  917.         'lbil'          // Array of instruments
  918.         <lbin-list>...  // Each instrument is encapsulated in a list
  919.     )
  920.  
  921.         // <lbin-list>
  922.         LIST
  923.         (
  924.             'lbin'
  925.             <bins-ck>
  926.             [<DMRF-list>]       // Optional reference to DLS Collection file.
  927.         )
  928.  
  929.             // <bins-ck>            // Instrument chunk
  930.             (
  931.                 'bins'
  932.                 <DMUS_IO_INSTRUMENT>    // Instrument header
  933.             )
  934. */      
  935.  
  936. /* This RIFF id and io struct have been added to allow wave files (and the wave object) to 
  937.    differentiate between streaming and one-shot waves, and to give a prefetch for streaming
  938.    waves  */
  939.  
  940. #define DMUS_FOURCC_WAVEHEADER_CHUNK   mmioFOURCC('w','a','v','h')
  941.  
  942. typedef struct _DMUS_IO_WAVE_HEADER
  943. {
  944.     REFERENCE_TIME  rtReadAhead;    /* How far ahead in the stream wave data will be read (in REFERENCE_TIME).  Ignored for one-shot waves.  */
  945.     DWORD           dwFlags;        /* Various flags, including whether this is a streaming wave and whether it can be invalidated. */
  946. } DMUS_IO_WAVE_HEADER;
  947.  
  948.  
  949. /*  File io for Wave track */
  950.  
  951. /* RIFF ids: */
  952.  
  953. #define DMUS_FOURCC_WAVETRACK_LIST      mmioFOURCC('w','a','v','t')
  954. #define DMUS_FOURCC_WAVETRACK_CHUNK     mmioFOURCC('w','a','t','h')
  955. #define DMUS_FOURCC_WAVEPART_LIST       mmioFOURCC('w','a','v','p')
  956. #define DMUS_FOURCC_WAVEPART_CHUNK      mmioFOURCC('w','a','p','h')
  957. #define DMUS_FOURCC_WAVEITEM_LIST       mmioFOURCC('w','a','v','i')
  958. #define DMUS_FOURCC_WAVE_LIST           mmioFOURCC('w','a','v','e')
  959. #define DMUS_FOURCC_WAVEITEM_CHUNK      mmioFOURCC('w','a','i','h')
  960.  
  961. /* This flag is included in DMUS_IO_WAVE_TRACK_HEADER.dwFlags.  If set, the track will get its 
  962.    variations from a pattern track, via GetParam(GUID_Variations). */
  963. #define DMUS_WAVETRACKF_SYNC_VAR   0x1
  964. /* This is also included in DMUS_IO_WAVE_TRACK_HEADER.dwFlags.  If set, variation control 
  965.    information will persist from one playback instance to the next.*/
  966. #define DMUS_WAVETRACKF_PERSIST_CONTROL 0x2
  967.  
  968. typedef struct _DMUS_IO_WAVE_TRACK_HEADER
  969. {
  970.     long        lVolume;        /* Gain, in 1/100th of dB, to be applied to all waves.  Note:  All gain values should be negative. */
  971.     DWORD       dwFlags;        /* Flags, including whether this track syncs to a pattern track for its variations. */
  972. } DMUS_IO_WAVE_TRACK_HEADER;
  973.  
  974. typedef struct _DMUS_IO_WAVE_PART_HEADER
  975. {
  976.     long            lVolume;        /* Gain, in 1/100th of dB, to be applied to all waves in wave part.  Note:  All gain values should be negative. */
  977.     DWORD           dwVariations;   /* Variation mask for which of 32 variations */
  978.     DWORD           dwPChannel;     /* PChannel */
  979.     DWORD           dwLockToPart;   /* Part ID to lock to. */
  980.     DWORD           dwFlags;        /* Flags, including stuff for managing how variations are chosen (in low-order nibble) */
  981.     DWORD           dwIndex;        /* Index for distinguishing multiple parts on the same PChannel*/
  982. } DMUS_IO_WAVE_PART_HEADER;
  983.  
  984. typedef struct _DMUS_IO_WAVE_ITEM_HEADER
  985. {
  986.     long            lVolume;        /* Gain, in 1/100th of dB.  Note:  All gain values should be negative. */
  987.     long            lPitch;         /* Pitch offset in 1/100th of a semitone. */
  988.     DWORD           dwVariations;   /* Variation flags for which of 32 variations this wave belongs to. */
  989.     REFERENCE_TIME  rtTime;         /* Start time, in REFERENCE_TIME, if clock time track, or MUSIC_TIME for music time track. */
  990.     REFERENCE_TIME  rtStartOffset;  /* Distance into wave to start playback, in reference time units. */
  991.     REFERENCE_TIME  rtReserved;     /* Reserved field. */
  992.     REFERENCE_TIME  rtDuration;     /* Duration, in REFERENCE_TIME or MUSIC_TIME, depending on track timing format. */
  993.     MUSIC_TIME      mtLogicalTime;  /* If in music track format, this indicates the musical boundary where this belongs. Otherwise, ignored. */
  994.     DWORD           dwLoopStart;    /* Start point for a looping wave. */
  995.     DWORD           dwLoopEnd;      /* End point for a looping wave. */
  996.     DWORD           dwFlags;        /* Various flags, including whether this is a streaming wave and whether it can be invalidated. */
  997. } DMUS_IO_WAVE_ITEM_HEADER;
  998.  
  999. /*
  1000. LIST
  1001. {
  1002.     'wavt'          // Wave track chunk
  1003.     <wath-ck>       // Wave track header
  1004.     <wavp-list>...  // Array of Wave Parts
  1005. }
  1006.     // <wath-ck>
  1007.     'wath'
  1008.     {
  1009.         <DMUS_IO_WAVE_TRACK_HEADER>
  1010.     }
  1011.  
  1012.     //  <wavp-list>
  1013.     LIST
  1014.     {
  1015.         'wavp'
  1016.         <waph-ck>       //  Wave Part Header
  1017.         <wavi-list>     //  List of wave items
  1018.     }
  1019.  
  1020.         //  <waph-ck>
  1021.         'waph'
  1022.         {
  1023.             <DMUS_IO_WAVE_PART_HEADER>
  1024.         }
  1025.  
  1026.         //  <wavi-list>
  1027.         LIST
  1028.         {
  1029.             'wavi'
  1030.             <wave-list>...  //  Array of waves; each wave is encapsulated in a list
  1031.         }
  1032.  
  1033.             //  <wave-list>
  1034.             LIST
  1035.             {
  1036.                 'wave'
  1037.                 <waih-ck>       //  Wave item header
  1038.                 <DMRF-list>     //  Reference to wave object
  1039.             }
  1040.  
  1041.                 //  <waih-ck>
  1042.                 'waih'
  1043.                 {
  1044.                     <DMUS_IO_WAVE_ITEM_HEADER>
  1045.                 }
  1046.  
  1047. */
  1048.  
  1049. /*  File io for DirectMusic Container file. This embeds a set of related files. And,
  1050.     in turn, it can be embedded within a segment or script file.
  1051. */
  1052.  
  1053. #define DMUS_FOURCC_CONTAINER_FORM          mmioFOURCC('D','M','C','N')
  1054. #define DMUS_FOURCC_CONTAINER_CHUNK         mmioFOURCC('c','o','n','h')
  1055. #define DMUS_FOURCC_CONTAINED_ALIAS_CHUNK   mmioFOURCC('c','o','b','a')
  1056. #define DMUS_FOURCC_CONTAINED_OBJECT_CHUNK  mmioFOURCC('c','o','b','h')
  1057. #define DMUS_FOURCC_CONTAINED_OBJECTS_LIST  mmioFOURCC('c','o','s','l')
  1058. #define DMUS_FOURCC_CONTAINED_OBJECT_LIST   mmioFOURCC('c','o','b','l')
  1059.  
  1060. typedef struct _DMUS_IO_CONTAINER_HEADER
  1061. {
  1062.     DWORD       dwFlags;        /* Flags. */
  1063. } DMUS_IO_CONTAINER_HEADER;
  1064.  
  1065. #define DMUS_CONTAINER_NOLOADS  (1 << 1)   /* Contained items are not loaded when the container is loaded.
  1066.                                               Entries will be created in the loader (via SetObject) but
  1067.                                               the actual objects will not be created until they are
  1068.                                               specifically loaded at a later time. */
  1069.  
  1070. typedef struct _DMUS_IO_CONTAINED_OBJECT_HEADER
  1071. {
  1072.     GUID        guidClassID;    /* Class id of object. */
  1073.     DWORD       dwFlags;        /* Flags, for example DMUS_CONTAINED_OBJF_KEEP. */
  1074.     FOURCC      ckid;           /* chunk ID of track's data chunk if 0 fccType valid. */
  1075.     FOURCC      fccType;        /* list type if NULL ckid valid */
  1076.         /* Note that LIST:DMRF may be used for ckid and fccType in order to reference an
  1077.            object instead of embedding it within the container. */
  1078. } DMUS_IO_CONTAINED_OBJECT_HEADER;
  1079.  
  1080. #define DMUS_CONTAINED_OBJF_KEEP    1   /* Keep the object cached in the loader after the container is released. */
  1081.  
  1082. /*
  1083. RIFF
  1084. (
  1085.     'DMCN'          // DirectMusic Container chunk
  1086.     <conh-ck>       // Container header chunk
  1087.     [<guid-ck>]     // GUID for container
  1088.     [<vers-ck>]     // Optional version info
  1089.     [<UNFO-list>]   // Name, author, copyright info., comments
  1090.     <cosl-list>     // List of objects.
  1091. )
  1092.  
  1093.     // <conh-ck>        
  1094.     'conh'
  1095.     (
  1096.         <DMUS_IO_CONTAINER_HEADER>
  1097.     )
  1098.     
  1099.     // <guid-ck>
  1100.     'guid'
  1101.     (
  1102.         <GUID>
  1103.     )
  1104.  
  1105.     // <vers-ck>
  1106.     vers
  1107.     (
  1108.         <DMUS_IO_VERSION>
  1109.     )
  1110.  
  1111.     LIST
  1112.     (
  1113.         'cosl'          // Array of embedded objects.
  1114.         <cobl-list>...  // Each object is encapsulated in a LIST chunk
  1115.     )
  1116.  
  1117.     // <cobl-list>      // Encapsulates one object
  1118.     LIST
  1119.     (
  1120.         'cobl'
  1121.         [<coba-ck>]         // Alias.  An alternative name by which this object is known
  1122.                             // within the container.
  1123.         <cobh-ck>           // Required header, includes CLASS ID for object.
  1124.         [<data>] or <DMRF>  // Object data of the type specified in <cobh-ck>.
  1125.                             // If DMRF, it is a reference of where to find the object.
  1126.                             // Otherwise, it could be any RIFF readable chunk in the
  1127.                             //    exact same format as a file.  The object will load
  1128.                             //    itself from this data.
  1129.     )
  1130.  
  1131.     // <coba-ck>
  1132.     'coba'
  1133.     (
  1134.         // Alias, stored as NULL terminated string of WCHARs
  1135.     )
  1136.  
  1137.     // <cobh-ck>
  1138.     'cobh'
  1139.     (
  1140.         <DMUS_IO_CONTAINED_OBJECT_HEADER>
  1141.     )
  1142. */
  1143.  
  1144. /*  File io for DirectMusic Segment object */
  1145.  
  1146. /* RIFF ids: */
  1147.  
  1148. #define DMUS_FOURCC_SEGMENT_FORM        mmioFOURCC('D','M','S','G')
  1149. #define DMUS_FOURCC_SEGMENT_CHUNK       mmioFOURCC('s','e','g','h')
  1150. #define DMUS_FOURCC_TRACK_LIST          mmioFOURCC('t','r','k','l')
  1151. #define DMUS_FOURCC_TRACK_FORM          mmioFOURCC('D','M','T','K')
  1152. #define DMUS_FOURCC_TRACK_CHUNK         mmioFOURCC('t','r','k','h')
  1153. #define DMUS_FOURCC_TRACK_EXTRAS_CHUNK  mmioFOURCC('t','r','k','x')
  1154.  
  1155. /* io structures:*/
  1156.  
  1157. typedef struct _DMUS_IO_SEGMENT_HEADER
  1158. {
  1159.     DWORD       dwRepeats;      /* Number of repeats. By default, 0. */
  1160.     MUSIC_TIME  mtLength;       /* Length, in music time. */
  1161.     MUSIC_TIME  mtPlayStart;    /* Start of playback. By default, 0. */
  1162.     MUSIC_TIME  mtLoopStart;    /* Start of looping portion. By default, 0. */
  1163.     MUSIC_TIME  mtLoopEnd;      /* End of loop. Must be greater than dwPlayStart. Or, 0, indicating loop full segment. */
  1164.     DWORD       dwResolution;   /* Default resolution. */
  1165.     /* Following added for DX8: */
  1166.     REFERENCE_TIME rtLength;    /* Length, in reference time (overrides music time length.) */
  1167.     DWORD       dwFlags;
  1168.     DWORD       dwReserved;     /* Reserved. */
  1169. } DMUS_IO_SEGMENT_HEADER;
  1170.  
  1171. #define DMUS_SEGIOF_REFLENGTH   1  /* Use the time in rtLength for the segment length. */
  1172.  
  1173. typedef struct _DMUS_IO_TRACK_HEADER
  1174. {
  1175.     GUID        guidClassID;    /* Class id of track. */
  1176.     DWORD       dwPosition;     /* Position in track list. */
  1177.     DWORD       dwGroup;        /* Group bits for track. */
  1178.     FOURCC      ckid;           /* chunk ID of track's data chunk. */
  1179.     FOURCC      fccType;        /* list type if ckid is RIFF or LIST */ 
  1180. } DMUS_IO_TRACK_HEADER;
  1181.  
  1182. /*  Additional parameters for the track header chunk, introduced in DX8 and
  1183.     on, are stored in a separate chunk. */
  1184.  
  1185. typedef struct _DMUS_IO_TRACK_EXTRAS_HEADER
  1186. {
  1187.     DWORD       dwFlags;        /* DX8 Added flags for control tracks. */
  1188.     DWORD       dwPriority;     /* Priority for composition. */
  1189. } DMUS_IO_TRACK_EXTRAS_HEADER;
  1190.  
  1191. /*
  1192. RIFF
  1193. (
  1194.     'DMSG'          // DirectMusic Segment chunk
  1195.     <segh-ck>       // Segment header chunk
  1196.     [<guid-ck>]     // GUID for segment
  1197.     [<vers-ck>]     // Optional version info
  1198.     [<UNFO-list>]   // Name, author, copyright info., comments
  1199.     [<DMCN-form>]   // Optional container of objects embedded in file. Must precede tracklist.
  1200.     <trkl-list>     // List of Tracks
  1201.     [<DMTG-form>]   // Optional ToolGraph
  1202.     [<DMAP-form>]   // Optional Audio Path
  1203. )
  1204.  
  1205.     // <segh-ck>        
  1206.     'segh'
  1207.     (
  1208.         <DMUS_IO_SEGMENT_HEADER>
  1209.     )
  1210.     
  1211.     // <guid-ck>
  1212.     'guid'
  1213.     (
  1214.         <GUID>
  1215.     )
  1216.  
  1217.     // <vers-ck>
  1218.     vers
  1219.     (
  1220.         <DMUS_IO_VERSION>
  1221.     )
  1222.  
  1223.     // <trkl-list>
  1224.     LIST
  1225.     (
  1226.         'trkl'          // Array of tracks
  1227.         <DMTK-form>...  // Each track is encapsulated in a RIFF chunk
  1228.     )
  1229.  
  1230.     // <DMTK-form>      // Tracks can be embedded in a segment or stored as separate files.
  1231.     RIFF
  1232.     (
  1233.         'DMTK'
  1234.         <trkh-ck>
  1235.         [<trkx-ck>]     // Optional track flags. 
  1236.         [<guid-ck>]     // Optional GUID for track object instance (not to be confused with Class id in track header)
  1237.         [<vers-ck>]     // Optional version info
  1238.         [<UNFO-list>]   // Optional name, author, copyright info., comments
  1239.         [<data>]        // Track data. Must be a RIFF readable chunk.
  1240.     )
  1241.  
  1242.     // <trkh-ck>            // Track header chunk
  1243.     (
  1244.         'trkh'
  1245.         <DMUS_IO_TRACK_HEADER>  // Track header
  1246.     )
  1247.  
  1248.     // <trkx-ck>            // Track flags chunk
  1249.     (
  1250.         'trkx'
  1251.         <DMUS_IO_TRACK_EXTRAS_HEADER>  // DX8 Track flags header
  1252.     )
  1253. */
  1254.  
  1255. /*  File io for DirectMusic Song object */
  1256. /*  Note: Song file format is not supported in DX8. */
  1257.  
  1258. /* RIFF ids: */
  1259.  
  1260. #define DMUS_FOURCC_SONG_FORM           mmioFOURCC('D','M','S','O') /* Entire song. */
  1261. #define DMUS_FOURCC_SONG_CHUNK          mmioFOURCC('s','n','g','h') /* Song header info. */
  1262. #define DMUS_FOURCC_SONGSEGMENTS_LIST   mmioFOURCC('s','e','g','l') /* List of embedded segments. */
  1263. #define DMUS_FOURCC_SONGSEGMENT_LIST    mmioFOURCC('s','s','g','l') /* Container for a segment or segment reference. */
  1264. #define DMUS_FOURCC_TOOLGRAPHS_LIST     mmioFOURCC('t','l','g','l') /* List of embedded tool graphs. */
  1265. #define DMUS_FOURCC_SEGREFS_LIST        mmioFOURCC('s','r','s','l') /* List of segment references. */
  1266. #define DMUS_FOURCC_SEGREF_LIST         mmioFOURCC('s','g','r','l') /* Container for a segment reference. */
  1267. #define DMUS_FOURCC_SEGREF_CHUNK        mmioFOURCC('s','g','r','h') /* Segment reference header. */
  1268. #define DMUS_FOURCC_SEGTRANS_CHUNK      mmioFOURCC('s','t','r','h') /* Set of transitions to this segment. */
  1269. #define DMUS_FOURCC_TRACKREFS_LIST      mmioFOURCC('t','r','s','l') /* Set of track references within the segment reference. */
  1270. #define DMUS_FOURCC_TRACKREF_LIST       mmioFOURCC('t','k','r','l') /* Container for a track reference. */
  1271. #define DMUS_FOURCC_TRACKREF_CHUNK      mmioFOURCC('t','k','r','h') /* Track reference header. */
  1272.  
  1273. /* io structures:*/
  1274.  
  1275. typedef struct _DMUS_IO_SONG_HEADER
  1276. {
  1277.     DWORD       dwFlags;
  1278.     DWORD       dwStartSegID;   /* Id of the segment that starts playback. */
  1279. } DMUS_IO_SONG_HEADER;
  1280.  
  1281. typedef struct _DMUS_IO_SEGREF_HEADER
  1282. {
  1283.     DWORD       dwID;           /* Each has a unique ID. Must be less than DMUS_SONG_MAXSEGID. */
  1284.     DWORD       dwSegmentID;    /* Optional segment to link to. */
  1285.     DWORD       dwToolGraphID;  /* Optional tool graph to use for processing. */
  1286.     DWORD       dwFlags;        /* Various control flags. Currently reserved for future use. Must be 0. */
  1287.     DWORD       dwNextPlayID;   /* ID of next segment, to chain segments into a song. */
  1288. } DMUS_IO_SEGREF_HEADER;
  1289.  
  1290.  
  1291. typedef struct _DMUS_IO_TRACKREF_HEADER
  1292. {
  1293.     DWORD       dwSegmentID;    /* Which segment to find this in. */
  1294.     DWORD       dwFlags;        /* Reference control flags. */
  1295. } DMUS_IO_TRACKREF_HEADER;
  1296.  
  1297. /*  Transition definition chunk defines a transition, using an optional transition template
  1298.     segment.
  1299. */
  1300.  
  1301. typedef struct _DMUS_IO_TRANSITION_DEF
  1302. {
  1303.     DWORD       dwSegmentID;        /* Segment the transition goes to. */
  1304.     DWORD       dwTransitionID;     /* Template segment to use for the transition. */
  1305.     DWORD       dwPlayFlags;        /* Flags to use for transition. */
  1306. } DMUS_IO_TRANSITION_DEF;
  1307.  
  1308. #define DMUS_SONG_MAXSEGID      0x7FFFFFFF  /* Segment ids can not go higher than this. */
  1309. #define DMUS_SONG_ANYSEG        0x80000000  /* Special ID to indicate any segment. */
  1310. #define DMUS_SONG_NOSEG         0xFFFFFFFF  /* Special ID to indicate no segment. */
  1311. #define DMUS_SONG_NOFROMSEG     0x80000001  /* Special ID for dwSegmentID to indicate transition from nothing (or outside the song) into this segment. */
  1312.  
  1313. /*
  1314. RIFF
  1315. (
  1316.     'DMSO'          // DirectMusic Song chunk
  1317.     <sngh-ck>       // Song header chunk
  1318.     [<guid-ck>]     // GUID for song
  1319.     [<vers-ck>]     // Optional version info
  1320.     [<UNFO-list>]   // Name, author, copyright info., comments
  1321.     [<DMCN-form>]   // Optional container of objects embedded in file. Must precede segment list.
  1322.     <segl-list>     // List of Segments
  1323.     [<tlgl-list>]   // Optional list of ToolGraphs
  1324.     [<DMAP-form>]   // Optional Audio Path - to be shared by all segments in song.
  1325.     <srsl-list>     // List of segment references.
  1326. )
  1327.  
  1328.     // <sngh-ck>        
  1329.     'sngh'
  1330.     (
  1331.         <DMUS_IO_SONG_HEADER>
  1332.     )
  1333.     
  1334.     // <segl-list>
  1335.     LIST
  1336.     (
  1337.         'segl'          // Array of segments
  1338.         <ssgl-list>...  // Each segment is wrapped in this.
  1339.     )
  1340.  
  1341.     // <ssgl-list>
  1342.     LIST
  1343.     (
  1344.         'ssgl'          // Segment container.
  1345.         [DMSG-form]     // Each segment is either a full embedded segment RIFF form.
  1346.         [DMRF-list]     // Or a reference to an external segment.
  1347.     )
  1348.  
  1349.     // <tlgl-list>
  1350.     LIST
  1351.     (
  1352.         'tlgl'          // Array of toolgraphs
  1353.         <DMTG-form>...  // Each toolgraph is a full RIFF form.
  1354.     )
  1355.  
  1356.     // <srsl-list>
  1357.     LIST
  1358.     (
  1359.         'srsl'          // Array of segment references
  1360.         <sgrl-list>...  // Each segment reference is contained in a RIFF list.
  1361.     )
  1362.  
  1363.     // <sgrl-list>      // Segment reference container.
  1364.     LIST
  1365.     (
  1366.         'sgrl'
  1367.         <sgrh-ck>       // Segment reference header chunk.
  1368.         <segh-ck>       // Segment header chunk. Defines the segment. 
  1369.         <UNFO-list>     // Name, author, etc. Primarily for name, though, which is required for Song->GetSegment().
  1370.         [<strh-ck>]     // Segment transition chunk. Defines how to do transitions from other segments.
  1371.         [<trsl-list>]   // List of track references, to create a segment from tracks in multiple segments.
  1372.     )
  1373.  
  1374.     // <sgrh-ck>        // Segment reference header chunk
  1375.     (
  1376.         'sgrh'
  1377.         <DMUS_IO_SEGREF_HEADER>  // Segment reference header
  1378.     )
  1379.  
  1380.     // <strh-ck>        // Segment transition chunk. 
  1381.     (
  1382.         'strh'
  1383.         <DMUS_IO_TRANSITION_DEF>    // Default transition.
  1384.         <DMUS_IO_TRANSITION_DEF>... // Additional transitions.
  1385.     )
  1386.  
  1387.     // <trsl-list>      // Array of track references
  1388.     (
  1389.         'trsl'
  1390.         <tkrl-list>...  // Each track reference is multiple chunks in a tkrl list.
  1391.     )
  1392.  
  1393.     // <tkrl-list>      // Track reference container
  1394.     (
  1395.         'tkrl'
  1396.         <tkrh-ck>       // Track reference header chunk.
  1397.         <trkh-ck>       // Normal track header chunk.
  1398.         [<trkx-ck>]     // Optional track flags. 
  1399.     )
  1400.  
  1401.     // <tkrh-ck>        // Track reference header chunk
  1402.     (
  1403.         'tkrh'
  1404.         <DMUS_IO_TRACKREF_HEADER>  // Track reference header
  1405.     )
  1406. */
  1407.  
  1408. /*  File io for DirectMusic reference chunk. 
  1409.     This is used to embed a reference to an object.
  1410. */
  1411.  
  1412. /*  RIFF ids: */
  1413.  
  1414. #define DMUS_FOURCC_REF_LIST        mmioFOURCC('D','M','R','F')
  1415. #define DMUS_FOURCC_REF_CHUNK       mmioFOURCC('r','e','f','h')
  1416. #define DMUS_FOURCC_DATE_CHUNK      mmioFOURCC('d','a','t','e')
  1417. #define DMUS_FOURCC_NAME_CHUNK      mmioFOURCC('n','a','m','e')
  1418. #define DMUS_FOURCC_FILE_CHUNK      mmioFOURCC('f','i','l','e')
  1419.  
  1420. typedef struct _DMUS_IO_REFERENCE
  1421. {
  1422.     GUID    guidClassID;    /* Class id is always required. */
  1423.     DWORD   dwValidData;    /* Flags. */
  1424. } DMUS_IO_REFERENCE;
  1425.  
  1426. /*
  1427. LIST
  1428. (
  1429.     'DMRF'          // DirectMusic Reference chunk
  1430.     <refh-ck>       // Reference header chunk
  1431.     [<guid-ck>]     // Optional object GUID.
  1432.     [<date-ck>]     // Optional file date.
  1433.     [<name-ck>]     // Optional name.
  1434.     [<file-ck>]     // Optional file name.
  1435.     [<catg-ck>]     // Optional category name.
  1436.     [<vers-ck>]     // Optional version info.
  1437. )
  1438.  
  1439.     // <refh-ck>
  1440.     'refh'
  1441.     (
  1442.         <DMUS_IO_REFERENCE>
  1443.     )
  1444.  
  1445.     // <guid-ck>
  1446.     'guid'
  1447.     (
  1448.         <GUID>
  1449.     )
  1450.  
  1451.     // <date-ck>
  1452.     date
  1453.     (
  1454.         <FILETIME>
  1455.     )
  1456.  
  1457.     // <name-ck>
  1458.     name
  1459.     (
  1460.         // Name, stored as NULL terminated string of WCHARs
  1461.     )
  1462.  
  1463.     // <file-ck>
  1464.     file
  1465.     (
  1466.         // File name, stored as NULL terminated string of WCHARs
  1467.     )
  1468.  
  1469.     // <catg-ck>
  1470.     catg
  1471.     (
  1472.         // Category name, stored as NULL terminated string of WCHARs
  1473.     )
  1474.  
  1475.     // <vers-ck>
  1476.     vers
  1477.     (
  1478.         <DMUS_IO_VERSION>
  1479.     )
  1480. */
  1481.  
  1482. /* Chord Maps */
  1483.  
  1484. /* runtime chunks */
  1485. #define DMUS_FOURCC_CHORDMAP_FORM       mmioFOURCC('D','M','P','R')
  1486. #define DMUS_FOURCC_IOCHORDMAP_CHUNK    mmioFOURCC('p','e','r','h')
  1487. #define DMUS_FOURCC_SUBCHORD_CHUNK      mmioFOURCC('c','h','d','t')
  1488. #define DMUS_FOURCC_CHORDENTRY_CHUNK    mmioFOURCC('c','h','e','h')
  1489. #define DMUS_FOURCC_SUBCHORDID_CHUNK    mmioFOURCC('s','b','c','n')
  1490. #define DMUS_FOURCC_IONEXTCHORD_CHUNK   mmioFOURCC('n','c','r','d')
  1491. #define DMUS_FOURCC_NEXTCHORDSEQ_CHUNK  mmioFOURCC('n','c','s','q')
  1492. #define DMUS_FOURCC_IOSIGNPOST_CHUNK    mmioFOURCC('s','p','s','h')
  1493. #define DMUS_FOURCC_CHORDNAME_CHUNK     mmioFOURCC('I','N','A','M')
  1494.  
  1495. /* runtime list chunks */
  1496. #define DMUS_FOURCC_CHORDENTRY_LIST     mmioFOURCC('c','h','o','e')
  1497. #define DMUS_FOURCC_CHORDMAP_LIST       mmioFOURCC('c','m','a','p')
  1498. #define DMUS_FOURCC_CHORD_LIST          mmioFOURCC('c','h','r','d')
  1499. #define DMUS_FOURCC_CHORDPALETTE_LIST   mmioFOURCC('c','h','p','l')
  1500. #define DMUS_FOURCC_CADENCE_LIST        mmioFOURCC('c','a','d','e')
  1501. #define DMUS_FOURCC_SIGNPOSTITEM_LIST   mmioFOURCC('s','p','s','t')
  1502.  
  1503. #define DMUS_FOURCC_SIGNPOST_LIST       mmioFOURCC('s','p','s','q')
  1504.  
  1505. /* values for dwChord field of DMUS_IO_PERS_SIGNPOST */
  1506. /* DMUS_SIGNPOSTF_ flags are also used in templates (DMUS_IO_SIGNPOST) */
  1507. #define DMUS_SIGNPOSTF_A        1      
  1508. #define DMUS_SIGNPOSTF_B        2
  1509. #define DMUS_SIGNPOSTF_C        4
  1510. #define DMUS_SIGNPOSTF_D        8
  1511. #define DMUS_SIGNPOSTF_E        0x10
  1512. #define DMUS_SIGNPOSTF_F        0x20
  1513. #define DMUS_SIGNPOSTF_LETTER   (DMUS_SIGNPOSTF_A | DMUS_SIGNPOSTF_B | DMUS_SIGNPOSTF_C | DMUS_SIGNPOSTF_D | DMUS_SIGNPOSTF_E | DMUS_SIGNPOSTF_F)
  1514. #define DMUS_SIGNPOSTF_1        0x100
  1515. #define DMUS_SIGNPOSTF_2        0x200
  1516. #define DMUS_SIGNPOSTF_3        0x400
  1517. #define DMUS_SIGNPOSTF_4        0x800
  1518. #define DMUS_SIGNPOSTF_5        0x1000
  1519. #define DMUS_SIGNPOSTF_6        0x2000
  1520. #define DMUS_SIGNPOSTF_7        0x4000
  1521. #define DMUS_SIGNPOSTF_ROOT     (DMUS_SIGNPOSTF_1 | DMUS_SIGNPOSTF_2 | DMUS_SIGNPOSTF_3 | DMUS_SIGNPOSTF_4 | DMUS_SIGNPOSTF_5 | DMUS_SIGNPOSTF_6 | DMUS_SIGNPOSTF_7)
  1522. #define DMUS_SIGNPOSTF_CADENCE  0x8000
  1523.  
  1524. /* values for dwFlags field of DMUS_IO_CHORDMAP */
  1525. #define DMUS_CHORDMAPF_VERSION8  1   /* Chordmap is version 8 or above. */
  1526.  
  1527. /* values for dwChord field of DMUS_IO_PERS_SIGNPOST */
  1528. #define DMUS_SPOSTCADENCEF_1  2   /* Use the first cadence chord. */
  1529. #define DMUS_SPOSTCADENCEF_2  4   /* Use the second cadence chord. */
  1530.  
  1531. /* run time data structs */
  1532. typedef struct _DMUS_IO_CHORDMAP
  1533. {
  1534.     WCHAR   wszLoadName[20];
  1535.     DWORD   dwScalePattern;
  1536.     DWORD   dwFlags;           /* Various flags. Only lower 16 bits are significant. */
  1537. } DMUS_IO_CHORDMAP;
  1538.  
  1539. typedef struct _DMUS_IO_CHORDMAP_SUBCHORD
  1540. {
  1541.     DWORD   dwChordPattern;
  1542.     DWORD   dwScalePattern;
  1543.     DWORD   dwInvertPattern;
  1544.     BYTE    bChordRoot;
  1545.     BYTE    bScaleRoot;
  1546.     WORD    wCFlags;
  1547.     DWORD   dwLevels;   /* parts or which subchord levels this chord supports */
  1548. } DMUS_IO_CHORDMAP_SUBCHORD;
  1549.  
  1550. /* Legacy name... */
  1551. typedef DMUS_IO_CHORDMAP_SUBCHORD DMUS_IO_PERS_SUBCHORD;
  1552.  
  1553. typedef struct _DMUS_IO_CHORDENTRY
  1554. {
  1555.     DWORD   dwFlags;
  1556.     WORD    wConnectionID;  /* replaces runtime "pointer to this" */
  1557. } DMUS_IO_CHORDENTRY;
  1558.  
  1559. typedef struct _DMUS_IO_NEXTCHORD
  1560. {
  1561.     DWORD   dwFlags;
  1562.     WORD    nWeight;
  1563.     WORD    wMinBeats;
  1564.     WORD    wMaxBeats;
  1565.     WORD    wConnectionID;  /* points to an ioChordEntry */
  1566. } DMUS_IO_NEXTCHORD;
  1567.  
  1568. typedef struct _DMUS_IO_CHORDMAP_SIGNPOST
  1569. {
  1570.     DWORD   dwChords;   /* 1bit per group */
  1571.     DWORD   dwFlags;
  1572. } DMUS_IO_CHORDMAP_SIGNPOST;
  1573.  
  1574. /* Legacy name... */
  1575. typedef DMUS_IO_CHORDMAP_SIGNPOST DMUS_IO_PERS_SIGNPOST;
  1576.  
  1577. /*
  1578. RIFF
  1579. (
  1580.     'DMPR'
  1581.     <perh-ck>           // Chord map header chunk
  1582.     [<guid-ck>]         // guid chunk
  1583.     [<vers-ck>]         // version chunk (two DWORDS)
  1584.     [<UNFO-list>]       // Unfo chunk
  1585.     <chdt-ck>           // subchord database
  1586.     <chpl-list>         // chord palette
  1587.     <cmap-list>         // chord map
  1588.     <spsq-list>         // signpost list
  1589.  )
  1590.  
  1591. <cmap-list> ::= LIST('cmap' <choe-list> )
  1592.  
  1593. <choe-list> ::= LIST('choe'
  1594.                                 <cheh-ck>   // chord entry data
  1595.                                 <chrd-list> // chord definition
  1596.                                 <ncsq-ck>   // connecting(next) chords
  1597.                      )
  1598.  
  1599. <chrd-list> ::= LIST('chrd' 
  1600.                                 <INAM-ck>   // name of chord in wide char format
  1601.                                 <sbcn-ck>   // list of subchords composing chord
  1602.                     )
  1603.  
  1604. <chpl-list> ::= LIST('chpl' 
  1605.                                 <chrd-list> ... // chord definition
  1606.                     )
  1607.  
  1608. <spsq-list> ::== LIST('spsq' <spst-list> ... )
  1609.  
  1610. <spst-list> ::= LIST('spst'
  1611.                              <spsh-ck>
  1612.                              <chrd-list>
  1613.                              [<cade-list>]
  1614.                     )
  1615.  
  1616. <cade-list> ::= LIST('cade' <chrd-list> ...)
  1617.  
  1618. <perh-ck> ::= perh(<DMUS_IO_CHORDMAP>)
  1619.  
  1620. <chdt-ck> ::= chdt(<cbChordSize::WORD>
  1621.                    <DMUS_IO_PERS_SUBCHORD> ... )
  1622.  
  1623. <cheh-ck> ::= cheh(<DMUS_IO_CHORDENTRY>)
  1624.  
  1625. <sbcn-ck> ::= sbcn(<cSubChordID:WORD> ...)
  1626.  
  1627. <ncsq-ck> ::= ncsq(<wNextChordSize:WORD> 
  1628.                    <DMUS_IO_NEXTCHORD>...)
  1629.  
  1630. <spsh-ck> ::= spsh(<DMUS_IO_PERS_SIGNPOST>)
  1631.  
  1632. */
  1633.  
  1634. /*  File io for DirectMusic Script object */
  1635.  
  1636. /* RIFF ids: */
  1637.  
  1638. #define DMUS_FOURCC_SCRIPT_FORM             mmioFOURCC('D','M','S','C')
  1639. #define DMUS_FOURCC_SCRIPT_CHUNK            mmioFOURCC('s','c','h','d')
  1640. #define DMUS_FOURCC_SCRIPTVERSION_CHUNK     mmioFOURCC('s','c','v','e')
  1641. #define DMUS_FOURCC_SCRIPTLANGUAGE_CHUNK    mmioFOURCC('s','c','l','a')
  1642. #define DMUS_FOURCC_SCRIPTSOURCE_CHUNK      mmioFOURCC('s','c','s','r')
  1643.  
  1644. /* io structures:*/
  1645.  
  1646. typedef struct _DMUS_IO_SCRIPT_HEADER
  1647. {
  1648.     DWORD       dwFlags; /* DMUS_SCRIPTIOF_ flags */
  1649. } DMUS_IO_SCRIPT_HEADER;
  1650.  
  1651. #define DMUS_SCRIPTIOF_LOAD_ALL_CONTENT       (1 << 0)
  1652.     /* If set, when the script loads it will also load all the content in its container. */
  1653. #define DMUS_SCRIPTIOF_DOWNLOAD_ALL_SEGMENTS  (1 << 1)
  1654.     /* If set and LOAD_ALL_CONTENT is also set, when the script initializes it will also download all the segments in its container.
  1655.        If set and LOAD_ALL_CONTENT is not set, when the script calls segment.Load on a segment then the segment will also be downloaded.
  1656.        If not set, the script must manually download and unload by calling segment.DownloadSoundData and segment.UnloadSoundData. */
  1657.  
  1658. /*
  1659. RIFF
  1660. (
  1661.     'DMSC'              // DirectMusic Script chunk
  1662.     <schd-ck>           // Script header chunk
  1663.     [<guid-ck>]         // GUID for script
  1664.     [<vers-ck>]         // Optional version info
  1665.     [<UNFO-list>]       // Name, author, copyright info., comments
  1666.     <scve-ck>           // Version of DirectMusic this script was authored to run against
  1667.     <DMCN-form>         // Container of content referenced by the script.
  1668.     <scla-ck>           // ActiveX scripting language in which the script is written
  1669.     <scsr-ck> or <DMRF> // The script's source code.
  1670.                         // If scsr-ck, the source is embedding in the chunk.
  1671.                         // If DMRF, it is a reference of where to find a text file with the source.
  1672.                         //    Class id (guidClassID in DMUS_IO_REFERENCE) must be GUID_NULL because
  1673.                         //    this text file is not a DirectMusic object in its own right.
  1674. )
  1675.  
  1676.     // <schd-ck>
  1677.     'schd'
  1678.     (
  1679.         <DMUS_FOURCC_SCRIPT_CHUNK>
  1680.     )
  1681.     
  1682.     // <guid-ck>
  1683.     'guid'
  1684.     (
  1685.         <GUID>
  1686.     )
  1687.  
  1688.     // <vers-ck>
  1689.     vers
  1690.     (
  1691.         <DMUS_IO_VERSION>
  1692.     )
  1693.  
  1694.     // <scve-ck>
  1695.     scve
  1696.     (
  1697.         <DMUS_IO_VERSION>
  1698.     )
  1699.  
  1700.     'scla'
  1701.     (
  1702.         // Language name, stored as NULL terminated string of WCHARs
  1703.     )
  1704.  
  1705.     'scsr'
  1706.     (
  1707.         // Source code, stored as NULL terminated string of WCHARs
  1708.     )
  1709. */
  1710.  
  1711. /* Signpost tracks */
  1712.  
  1713. #define DMUS_FOURCC_SIGNPOST_TRACK_CHUNK     mmioFOURCC( 's', 'g', 'n', 'p' )
  1714.  
  1715.  
  1716. typedef struct _DMUS_IO_SIGNPOST
  1717. {
  1718.     MUSIC_TIME  mtTime;
  1719.     DWORD       dwChords;
  1720.     WORD        wMeasure;
  1721. } DMUS_IO_SIGNPOST;
  1722.  
  1723. /*
  1724.  
  1725.     // <sgnp-list>
  1726.     'sgnp'
  1727.     (
  1728.         //sizeof DMUS_IO_SIGNPOST: DWORD
  1729.         <DMUS_IO_SIGNPOST>...
  1730.     )
  1731.  
  1732. */
  1733.  
  1734. #define DMUS_FOURCC_MUTE_CHUNK  mmioFOURCC('m','u','t','e')
  1735.  
  1736. typedef struct _DMUS_IO_MUTE
  1737. {
  1738.     MUSIC_TIME  mtTime;
  1739.     DWORD       dwPChannel;
  1740.     DWORD       dwPChannelMap;
  1741. } DMUS_IO_MUTE;
  1742.  
  1743. /*
  1744.  
  1745.     // <mute-list>
  1746.     'mute'
  1747.     (
  1748.         //sizeof DMUS_IO_MUTE:DWORD
  1749.         <DMUS_IO_MUTE>...
  1750.     )
  1751.  
  1752.  
  1753. */
  1754.  
  1755. /* Used for both style and chord map tracks */
  1756.  
  1757. #define DMUS_FOURCC_TIME_STAMP_CHUNK    mmioFOURCC('s', 't', 'm', 'p')
  1758.  
  1759. /* Style tracks */
  1760.  
  1761. #define DMUS_FOURCC_STYLE_TRACK_LIST    mmioFOURCC('s', 't', 't', 'r')
  1762. #define DMUS_FOURCC_STYLE_REF_LIST      mmioFOURCC('s', 't', 'r', 'f')
  1763.  
  1764. /*
  1765.  
  1766.     // <sttr-list>
  1767.     LIST('sttr'
  1768.     (
  1769.         <strf-list>...  // Array of Style references
  1770.     )
  1771.  
  1772.     // <strf-list>
  1773.     LIST('strf'
  1774.     (
  1775.         <stmp-ck>
  1776.         <DMRF>
  1777.     )
  1778.  
  1779.   // <stmp-ck>
  1780.   'stmp'
  1781.   (
  1782.     // time:DWORD
  1783.   )
  1784.  
  1785. */
  1786.  
  1787. /* Chord map tracks */
  1788.  
  1789. #define DMUS_FOURCC_PERS_TRACK_LIST mmioFOURCC('p', 'f', 't', 'r')
  1790. #define DMUS_FOURCC_PERS_REF_LIST   mmioFOURCC('p', 'f', 'r', 'f')
  1791.  
  1792. /*
  1793.  
  1794.     // <pftr-list>
  1795.     LIST('pftr'
  1796.     (
  1797.         <pfrf-list>...  // Array of Chord map references
  1798.     )
  1799.  
  1800.     // <pfrf-list>
  1801.     LIST('pfrf'
  1802.     (
  1803.         <stmp-ck>
  1804.         <DMRF>
  1805.     )
  1806.  
  1807.   // <stmp-ck>
  1808.   'stmp'
  1809.   (
  1810.     // time:DWORD
  1811.   )
  1812.  
  1813. */
  1814.  
  1815. #define DMUS_FOURCC_TEMPO_TRACK     mmioFOURCC('t','e','t','r')
  1816.  
  1817. /*
  1818.     // tempo array
  1819.     'tetr'
  1820.     (
  1821.         // sizeof DMUS_IO_TEMPO_ITEM: DWORD
  1822.         <DMUS_IO_TEMPO_ITEM>...
  1823.     )
  1824.  */
  1825.  
  1826. #define DMUS_FOURCC_SEQ_TRACK       mmioFOURCC('s','e','q','t')
  1827. #define DMUS_FOURCC_SEQ_LIST        mmioFOURCC('e','v','t','l')
  1828. #define DMUS_FOURCC_CURVE_LIST      mmioFOURCC('c','u','r','l')
  1829.  
  1830. /*
  1831.     // sequence track
  1832.     'seqt'
  1833.     (
  1834.         // sequence array
  1835.         'evtl'
  1836.         (
  1837.             // sizeof DMUS_IO_SEQ_ITEM: DWORD
  1838.             <DMUS_IO_SEQ_ITEM>...
  1839.         )
  1840.         // curve array
  1841.         'curl'
  1842.         (
  1843.             // sizeof DMUS_IO_CURVE_ITEM: DWORD
  1844.             <DMUS_IO_CURVE_ITEM>...
  1845.         )
  1846.     )
  1847. */
  1848.  
  1849. #define DMUS_FOURCC_SYSEX_TRACK     mmioFOURCC('s','y','e','x')
  1850.  
  1851. /*
  1852.     // sysex track
  1853.     'syex'
  1854.     (
  1855.         {
  1856.             <DMUS_IO_SYSEX_ITEM>
  1857.             <BYTE>...    // Array of bytes, length defined in the DMUS_IO_SYSEXITEM structure
  1858.         }...
  1859.     )
  1860. */
  1861.  
  1862. #define DMUS_FOURCC_TIMESIGNATURE_TRACK mmioFOURCC('t','i','m','s')
  1863.  
  1864. typedef struct _DMUS_IO_TIMESIGNATURE_ITEM
  1865. {
  1866.     MUSIC_TIME    lTime;
  1867.     BYTE          bBeatsPerMeasure;   /* beats per measure (top of time sig) */
  1868.     BYTE          bBeat;              /* what note receives the beat (bottom of time sig.) */
  1869.                                       /* we can assume that 0 means 256th note */
  1870.     WORD          wGridsPerBeat;      /* grids per beat */
  1871. } DMUS_IO_TIMESIGNATURE_ITEM;
  1872.  
  1873. /*  DX6 time signature track
  1874.     
  1875.     'tims'
  1876.     (
  1877.         // size of DMUS_IO_TIMESIGNATURE_ITEM : DWORD
  1878.         <DMUS_IO_TIMESIGNATURE_ITEM>...
  1879.     )
  1880. */
  1881.  
  1882. /*  DX8 Time signature track. The track has been updated from DX7 to support a list of
  1883.     RIFF chunks. This will allow the time signature track to expand in the future.
  1884. */
  1885.  
  1886. #define DMUS_FOURCC_TIMESIGTRACK_LIST   mmioFOURCC('T','I','M','S')
  1887. #define DMUS_FOURCC_TIMESIG_CHUNK       DMUS_FOURCC_TIMESIGNATURE_TRACK
  1888.  
  1889. /*
  1890. LIST
  1891. (
  1892.     'TIMS'          // Time Signature Track list-type
  1893.     <tims-ck>       // Chunk containing an array of time signatures
  1894. )
  1895.  
  1896.     'tims'
  1897.     (
  1898.         // size of DMUS_IO_TIMESIGNATURE_ITEM : DWORD
  1899.         <DMUS_IO_TIMESIGNATURE_ITEM>...
  1900.     )
  1901.  
  1902. */
  1903.  
  1904. /*  DX8 Marker track. This is used to store valid start points and other
  1905.     flow control parameters that may come later. For example, if we want
  1906.     to implement more sophisticated looping and branching constructs, they
  1907.     would live in this track.
  1908. */
  1909.  
  1910. #define DMUS_FOURCC_MARKERTRACK_LIST    mmioFOURCC('M','A','R','K')
  1911. #define DMUS_FOURCC_VALIDSTART_CHUNK    mmioFOURCC('v','a','l','s')
  1912. #define DMUS_FOURCC_PLAYMARKER_CHUNK    mmioFOURCC('p','l','a','y')
  1913.  
  1914. /* io structures */
  1915. typedef struct _DMUS_IO_VALID_START
  1916. {
  1917.     MUSIC_TIME mtTime;      /* Time of a legal start. */
  1918. } DMUS_IO_VALID_START;
  1919.  
  1920. typedef struct _DMUS_IO_PLAY_MARKER
  1921. {
  1922.     MUSIC_TIME mtTime;      /* Time of a next legal play point marker. */
  1923. } DMUS_IO_PLAY_MARKER;
  1924.  
  1925. /*
  1926. LIST
  1927. (
  1928.     'MARK'          // Marker Track list-type
  1929.     [<vals-ck>]     // Chunk containing an array of start points
  1930.     [<play-ck>]     // Chunk containing an array of play start markers
  1931. )
  1932.  
  1933.     'vals'
  1934.     (
  1935.         // size of DMUS_IO_VALID_START : DWORD
  1936.         <DMUS_IO_VALID_START>...
  1937.     )
  1938.  
  1939.     'play'
  1940.     (
  1941.         // size of DMUS_IO_PLAY_MARKER : DWORD
  1942.         <DMUS_IO_PLAY_MARKER>...
  1943.     )
  1944.   
  1945. */
  1946.  
  1947. /* segment trigger tracks */
  1948.  
  1949. /* RIFF ids: */
  1950. #define DMUS_FOURCC_SEGTRACK_LIST                   mmioFOURCC('s','e','g','t')
  1951. #define DMUS_FOURCC_SEGTRACK_CHUNK                  mmioFOURCC('s','g','t','h')
  1952. #define DMUS_FOURCC_SEGMENTS_LIST                   mmioFOURCC('l','s','g','l')
  1953. #define DMUS_FOURCC_SEGMENT_LIST                    mmioFOURCC('l','s','e','g')
  1954. #define DMUS_FOURCC_SEGMENTITEM_CHUNK               mmioFOURCC('s','g','i','h')
  1955. #define DMUS_FOURCC_SEGMENTITEMNAME_CHUNK           mmioFOURCC('s','n','a','m')
  1956.  
  1957. /* io structures */
  1958. typedef struct _DMUS_IO_SEGMENT_TRACK_HEADER
  1959. {
  1960.     DWORD dwFlags; /* Reserved leave as 0. */
  1961. } DMUS_IO_SEGMENT_TRACK_HEADER;
  1962.  
  1963. typedef struct _DMUS_IO_SEGMENT_ITEM_HEADER
  1964. {
  1965.     MUSIC_TIME      lTimeLogical;    /* Position in track list. Time in the music with which the event is associated. */
  1966.     MUSIC_TIME      lTimePhysical;   /* Precise time event will be triggered. Should be close to logical time. */
  1967.     DWORD           dwPlayFlags;     /* Flags for PlaySegment(). */
  1968.     DWORD           dwFlags;         /* Flags. */
  1969. } DMUS_IO_SEGMENT_ITEM_HEADER;
  1970.  
  1971. /* values for dwflags field of DMUS_IO_SEGMENT_ITEM_HEADER */
  1972. #define DMUS_SEGMENTTRACKF_MOTIF                 1        /* interpret DMRF as link to style, and use snam as the name of a motif within the style */
  1973.  
  1974. /*
  1975. LIST
  1976. (
  1977.     'segt'          // DirectMusic Segment Trigger Track form-type
  1978.     [<sgth-ck>]     // Segment track header
  1979.     <lsgl-list>     // List of Segment Lists
  1980. )
  1981.  
  1982.     // <sgth-ck>
  1983.     'sgth'
  1984.     (
  1985.         <DMUS_IO_SEGMENT_TRACK_HEADER>
  1986.     )
  1987.  
  1988.     // <lsgl-list>
  1989.     LIST
  1990.     (
  1991.         'lsgl'          // Array of segments
  1992.         <lseg-list>...  // Each segment is encapsulated in a list (that way it can still be riff parsed.)
  1993.     )
  1994.  
  1995.         // <lseg-list>
  1996.         LIST
  1997.         (
  1998.             'lseg'
  1999.             <sgih-ck>
  2000.             <DMRF-list>    // Link to a segment or style file.
  2001.             [<snam-ck>]    // Name field.  Used with DMUS_SEGMENTTRACKF_MOTIF flag.
  2002.         )
  2003.  
  2004.             // <sgih-ck>            // segment item header
  2005.             (
  2006.                 <DMUS_IO_SEGMENT_ITEM_HEADER>  // Segment item header
  2007.             )
  2008.  
  2009.             // <snam-ck>
  2010.             (
  2011.                 // Name, stored as NULL terminated string of WCHARs
  2012.             )
  2013. */      
  2014.  
  2015. /* Script track. */
  2016.  
  2017. /* RIFF ids: */
  2018. #define DMUS_FOURCC_SCRIPTTRACK_LIST                mmioFOURCC('s','c','r','t')
  2019. #define DMUS_FOURCC_SCRIPTTRACKEVENTS_LIST          mmioFOURCC('s','c','r','l')
  2020. #define DMUS_FOURCC_SCRIPTTRACKEVENT_LIST           mmioFOURCC('s','c','r','e')
  2021. #define DMUS_FOURCC_SCRIPTTRACKEVENTHEADER_CHUNK    mmioFOURCC('s','c','r','h')
  2022. #define DMUS_FOURCC_SCRIPTTRACKEVENTNAME_CHUNK      mmioFOURCC('s','c','r','n')
  2023.  
  2024. /* Flags for DMUS_IO_SCRIPTTRACK_TIMING
  2025.  */
  2026. #define DMUS_IO_SCRIPTTRACKF_PREPARE (1 << 0)        /* Fire event in advance of time stamp, at Prepare time.  This is the default because it leaves the script time to change the music happening at the target time. */
  2027. #define DMUS_IO_SCRIPTTRACKF_QUEUE   (1 << 1)        /* Fire event just before time stamp, at Queue time. */
  2028. #define DMUS_IO_SCRIPTTRACKF_ATTIME  (1 << 2)        /* Fire event right at the time stamp. */
  2029.  
  2030. typedef struct _DMUS_IO_SCRIPTTRACK_EVENTHEADER
  2031. {
  2032.     DWORD dwFlags;              /* various bits (see DMUS_IO_SCRIPTTRACKF_*) */
  2033.     MUSIC_TIME lTimeLogical;    /* Position in track list. Time in the music with which the event is associated. */
  2034.     MUSIC_TIME lTimePhysical;   /* Precise time event will be triggered. Should be close to logical time. */
  2035. } DMUS_IO_SCRIPTTRACK_EVENTHEADER;
  2036.  
  2037. /*
  2038.     // Script Track
  2039.  
  2040.     // <scrt-list>
  2041.     LIST
  2042.     (
  2043.         <scrl-list>       // List of script events
  2044.     )
  2045.  
  2046.         // <scrl-list>
  2047.         LIST
  2048.         (
  2049.             <scre-list>...    // Array of event descriptions
  2050.         )
  2051.  
  2052.             // <scre-list>
  2053.             LIST
  2054.             (
  2055.                 <scrh-ck>         // Event header chunk
  2056.                 <DMRF>
  2057.                 <scrn-ck>         // Routine name
  2058.             )
  2059.  
  2060.                 'scrh'
  2061.                 (
  2062.                     <DMUS_IO_SCRIPTTRACK_EVENTHEADER>
  2063.                 )
  2064.  
  2065.                 'scrn'
  2066.                 (
  2067.                     // Name, stored as NULL terminated string of WCHARs
  2068.                 )
  2069. */
  2070.  
  2071. /* Lyrics/Notification track. */
  2072.  
  2073. /* RIFF ids: */
  2074. #define DMUS_FOURCC_LYRICSTRACK_LIST                mmioFOURCC('l','y','r','t')
  2075. #define DMUS_FOURCC_LYRICSTRACKEVENTS_LIST          mmioFOURCC('l','y','r','l')
  2076. #define DMUS_FOURCC_LYRICSTRACKEVENT_LIST           mmioFOURCC('l','y','r','e')
  2077. #define DMUS_FOURCC_LYRICSTRACKEVENTHEADER_CHUNK    mmioFOURCC('l','y','r','h')
  2078. #define DMUS_FOURCC_LYRICSTRACKEVENTTEXT_CHUNK      mmioFOURCC('l','y','r','n')
  2079.  
  2080. typedef struct _DMUS_IO_LYRICSTRACK_EVENTHEADER
  2081. {
  2082.     DWORD dwFlags;              /* Reserved leave as 0. */
  2083.     DWORD dwTimingFlags;        /* Combination DMUS_PMSGF_TOOL_* flags.  Determines the precise timing of when the notification happens. Invalid with the flag DMUS_PMSGF_REFTIME, DMUS_PMSGF_MUSICTIME, DMUS_PMSGF_TOOL_FLUSH, or DMUS_PMSGF_LOCKTOREFTIME. */
  2084.     MUSIC_TIME lTimeLogical;    /* Position in track list. Time in the music with which the event is associated. */
  2085.     MUSIC_TIME lTimePhysical;   /* Precise time event will be triggered. Should be close to logical time. */
  2086. } DMUS_IO_LYRICSTRACK_EVENTHEADER;
  2087.  
  2088. /*
  2089.     // Lyrics/Notification Track
  2090.  
  2091.     // <lyrt-list>
  2092.     LIST
  2093.     (
  2094.         <lyrl-list>       // List of notification events
  2095.     )
  2096.  
  2097.         // <lyrl-list>
  2098.         LIST
  2099.         (
  2100.             <lyre-list>...    // Array of event descriptions
  2101.         )
  2102.  
  2103.             // <lyre-list>
  2104.             LIST
  2105.             (
  2106.                 <lyrh-ck>         // Event header chunk
  2107.                 <lyrn-ck>         // Notification text
  2108.             )
  2109.  
  2110.                 'lyrh'
  2111.                 (
  2112.                     <DMUS_IO_LYRICSTRACK_EVENTHEADER>
  2113.                 )
  2114.  
  2115.                 'lyrn'
  2116.                 (
  2117.                     // Name, stored as NULL terminated string of WCHARs
  2118.                 )
  2119. */
  2120.  
  2121. /* Parameter control track */
  2122.  
  2123. /* RIFF ids: */
  2124. #define DMUS_FOURCC_PARAMCONTROLTRACK_TRACK_LIST            mmioFOURCC('p','r','m','t')
  2125. #define DMUS_FOURCC_PARAMCONTROLTRACK_OBJECT_LIST           mmioFOURCC('p','r','o','l')
  2126. #define DMUS_FOURCC_PARAMCONTROLTRACK_OBJECT_CHUNK          mmioFOURCC('p','r','o','h')
  2127. #define DMUS_FOURCC_PARAMCONTROLTRACK_PARAM_LIST            mmioFOURCC('p','r','p','l')
  2128. #define DMUS_FOURCC_PARAMCONTROLTRACK_PARAM_CHUNK           mmioFOURCC('p','r','p','h')
  2129. #define DMUS_FOURCC_PARAMCONTROLTRACK_CURVES_CHUNK          mmioFOURCC('p','r','c','c')
  2130.  
  2131. typedef struct _DMUS_IO_PARAMCONTROLTRACK_OBJECTHEADER
  2132. {
  2133.     DWORD dwFlags;              /* Reserved.  Must be zero. */
  2134.     GUID guidTimeFormat;        /* Time format to set the object to.  Must be GUID_TIME_REFERNCE or GUID_TIME_MUSIC from medparam.h. */
  2135.     /* Path for finding the object. These fields correspond to the first five parameters of IDirectMusicSegmentState::GetObjectInPath. */
  2136.     DWORD dwPChannel;
  2137.     DWORD dwStage;
  2138.     DWORD dwBuffer;
  2139.     GUID guidObject;
  2140.     DWORD dwIndex;
  2141. } DMUS_IO_PARAMCONTROLTRACK_OBJECTHEADER;
  2142.  
  2143. typedef struct _DMUS_IO_PARAMCONTROLTRACK_PARAMHEADER
  2144. {
  2145.     DWORD dwFlags;              /* Reserved.  Must be zero. */
  2146.     DWORD dwIndex;              /* Index number of the parameter on the object */
  2147. } DMUS_IO_PARAMCONTROLTRACK_PARAMHEADER;
  2148.  
  2149. typedef struct _DMUS_IO_PARAMCONTROLTRACK_CURVEINFO
  2150. {
  2151.     MUSIC_TIME  mtStartTime;
  2152.     MUSIC_TIME  mtEndTime;
  2153.     float       fltStartValue;
  2154.     float       fltEndValue;
  2155.     DWORD       dwCurveType;   /* One of the items from the MP_CURVE_TYPE enum in medparam.h */
  2156.     DWORD       dwFlags;       /* A combination of the MPF_ENVLP_* constants in medparam.h */
  2157. } DMUS_IO_PARAMCONTROLTRACK_CURVEINFO;
  2158.  
  2159. /*
  2160.     // <prmt-list>
  2161.     LIST
  2162.     (
  2163.         <prol-list>...   // one for each object
  2164.     )
  2165.  
  2166.         // <prol-list>
  2167.         LIST
  2168.         (
  2169.             <proh-ck>       // object header chunk
  2170.             <prpl-list>...  // one for each parameter
  2171.         )
  2172.  
  2173.             // <proh-ck>
  2174.             proh
  2175.             (
  2176.                 <DMUS_IO_PARAMCONTROLTRACK_OBJECTHEADER>
  2177.             )
  2178.  
  2179.             // <prpl-list>
  2180.             LIST
  2181.             (
  2182.                 <prph-ck>       // parameter header chunk
  2183.                 <prcc-ck>       // chunk containing an array of curves
  2184.             )
  2185.  
  2186.                 // <prph-ck>
  2187.                 prph
  2188.                 (
  2189.                     <DMUS_IO_PARAMCONTROLTRACK_PARAMHEADER>
  2190.                 )
  2191.  
  2192.                 // <prcc-ck>
  2193.                 prcc
  2194.                 (
  2195.                     // sizeof DMUS_IO_PARAMCONTROLTRACK_CURVEINFO:DWORD
  2196.                     <DMUS_IO_PARAMCONTROLTRACK_CURVEINFO>... // curves, sorted in order of mtTime
  2197.                 )
  2198. */
  2199.  
  2200. /* Melody formulation track */
  2201. /* Note: Melody formulation file format is not supported in DX8. */
  2202.  
  2203. typedef DMUS_CONNECTION_RULE DMUS_IO_CONNECTION_RULE; /* defined in dmusici.h */
  2204.  
  2205. typedef DMUS_MELODY_FRAGMENT DMUS_IO_MELODY_FRAGMENT; /* defined in dmusici.h */
  2206.  
  2207. #define DMUS_FOURCC_MELODYFORM_TRACK_LIST     mmioFOURCC( 'm', 'f', 'r', 'm' )
  2208. #define DMUS_FOURCC_MELODYFORM_HEADER_CHUNK   mmioFOURCC( 'm', 'l', 'f', 'h' )
  2209. #define DMUS_FOURCC_MELODYFORM_BODY_CHUNK     mmioFOURCC( 'm', 'l', 'f', 'b' )
  2210.  
  2211. typedef struct _DMUS_IO_MELFORM
  2212. {
  2213.     DWORD        dwPlaymode;       /* NOT CURRENTLY USED - MUST BE 0 */   
  2214. } DMUS_IO_MELFORM;
  2215.  
  2216.  
  2217. /*
  2218.     // <mfrm-list>
  2219.     LIST
  2220.     (
  2221.         'mfrm'
  2222.         <mlfh-ck>       // Melody formulation header chunk
  2223.         <mlfb-ck>       // Melody formulation body chunk
  2224.     )
  2225.  
  2226.     // <mlfb-ck>
  2227.     'mlfb'
  2228.     (
  2229.         <DMUS_IO_MELFORM>
  2230.     )
  2231.  
  2232.   // <mlfb-ck>
  2233.     'mlfb'
  2234.     (
  2235.         //sizeof DMUS_IO_MELODY_FRAGMENT: DWORD
  2236.         <DMUS_IO_MELODY_FRAGMENT>...
  2237.     )
  2238.  
  2239. */
  2240.  
  2241. #if (DIRECTSOUND_VERSION >= 0x0800)
  2242.  
  2243. /* DirectSoundBufferConfig FX Map */
  2244.  
  2245. /* RIFF ids: */
  2246.  
  2247. #define DMUS_FOURCC_DSBC_FORM       mmioFOURCC('D','S','B','C')
  2248. #define DMUS_FOURCC_DSBD_CHUNK      mmioFOURCC('d','s','b','d')
  2249. #define DMUS_FOURCC_BSID_CHUNK      mmioFOURCC('b','s','i','d')
  2250. #define DMUS_FOURCC_DS3D_CHUNK      mmioFOURCC('d','s','3','d')
  2251. #define DMUS_FOURCC_DSBC_LIST       mmioFOURCC('f','x','l','s')
  2252. #define DMUS_FOURCC_DSFX_FORM       mmioFOURCC('D','S','F','X')
  2253. #define DMUS_FOURCC_DSFX_CHUNK      mmioFOURCC('f','x','h','r')
  2254. #define DMUS_FOURCC_DSFX_DATA       mmioFOURCC('d','a','t','a')
  2255.  
  2256. /* io structures */
  2257.  
  2258. typedef struct _DSOUND_IO_DSBUFFERDESC
  2259. {
  2260.     DWORD dwFlags;        /* DirectSound buffer creation flags */
  2261.     WORD nChannels;       /* No. of channels (rest of buffer format is determined by owning sink) */
  2262.     LONG lVolume;         /* Initial pan; only used if CTRLVOLUME is specified */
  2263.     LONG lPan;            /* Initial pan; only used if CTRLPAN is specified */
  2264.     DWORD dwReserved;     /* Reserved - must be 0 */
  2265. } DSOUND_IO_DSBUFFERDESC;
  2266.  
  2267. typedef struct _DSOUND_IO_DSBUSID
  2268. {
  2269.     DWORD busid[1];       /* Array size determined from chunk size */
  2270. } DSOUND_IO_DSBUSID;
  2271.  
  2272. typedef struct _DSOUND_IO_3D
  2273. {
  2274.     GUID guid3DAlgorithm; /* GUID identifying the 3D algorithm to use (defined in dsound.h) */
  2275.     DS3DBUFFER ds3d;      /* Initial 3D parameters */
  2276. } DSOUND_IO_3D;
  2277.  
  2278. typedef struct _DSOUND_IO_DXDMO_HEADER
  2279. {
  2280.     DWORD dwEffectFlags;  /* Effect creation flags - equivalent to DSEFFECTDESC::dwFlags */
  2281.     GUID guidDSFXClass;   /* GUID identifying the effect to use - corresponds to a COM CLSID */
  2282.     GUID guidReserved;    /* Reserved - must be the null GUID */
  2283.     GUID guidSendBuffer;  /* GUID identifying the buffer to send to if this is a send effect */
  2284.     DWORD dwReserved;     /* Reserved - must be 0 */
  2285. } DSOUND_IO_DXDMO_HEADER;
  2286.  
  2287. typedef struct _DSOUND_IO_DXDMO_DATA
  2288. {
  2289.     DWORD data[1];      /* Array size determined by the DMO involved */
  2290. } DSOUND_IO_DXDMO_DATA;
  2291.  
  2292. /*
  2293. RIFF
  2294. (
  2295.     'DSBC'          // DirectSoundBufferConfig chunk
  2296.     [<guid-ck>]     // GUID identifier for this DirectSoundBufferConfig
  2297.     [<vers-ck>]     // Optional version info
  2298.     [<UNFO-list>]   // Name, author, copyright info., comments
  2299.     <dsbd-ck>       // DirectSound Buffer descriptor chunk
  2300.     [<bsid-ck>]     // Optional bus id array
  2301.     [<ds3d-ck>]     // Optional 3d Parameters
  2302.     [<fxls-list>]   // Optional list of FX descriptors
  2303. )
  2304.  
  2305.     // <guid-ck>
  2306.     'guid'
  2307.     (
  2308.         <GUID>
  2309.     )
  2310.  
  2311.     // <vers-ck>
  2312.     'vers'
  2313.     (
  2314.         <DMUS_IO_VERSION>
  2315.     )
  2316.  
  2317.     // <dsbd-ck>
  2318.     'dsbd'
  2319.     (
  2320.         <DSOUND_IO_DSBUFFERDESC>  // Creation parameters and initial settings for the buffer
  2321.     )
  2322.  
  2323.     // <bsid-ck>
  2324.     'bsid'
  2325.     (
  2326.         <DSOUND_IO_DSBUSID>  // The size of DSOUND_IO_DSBUSID is determined by the chunk size 
  2327.     )
  2328.  
  2329.     // <ds3d-ck>
  2330.     'ds3d'
  2331.     (
  2332.         <DSOUND_IO_3D>  // Initial 3D buffer parameters: position, etc.
  2333.     )
  2334.  
  2335.     // <fx-list>
  2336.     LIST
  2337.     (
  2338.         'fxls'          // Array of DMO creation parameter blocks
  2339.         <DSFX-form>...  // Each DMO is encapsulated in a RIFF chunk
  2340.     )
  2341.  
  2342. // <DSFX-form>          // DMOs can be embedded in a buffer configuration or stored as separate files
  2343. RIFF
  2344. (
  2345.     'DSFX'
  2346.     <fxhr-ck>           // FX header chunk
  2347.     [<data-ck>]         // FX initial settings chunk
  2348. )
  2349.  
  2350.     // <fxhr-ck>
  2351.     'fxhr'
  2352.     (
  2353.         <DSOUND_IO_DXDMO_HEADER>
  2354.     )
  2355.  
  2356.     // <data-ck>
  2357.     'data'
  2358.     (
  2359.         <DSOUND_IO_DXDMO_DATA>  // Opaque data block used by the DMO to load itself.
  2360.         // For our standard included DMOs, this is simply the structure accepted by
  2361.         // the DMO's SetAllParameters() method - e.g. struct DSFXChorus for Chorus.
  2362.     )
  2363. */
  2364.  
  2365. #endif
  2366.  
  2367. #ifdef __cplusplus
  2368. }; /* extern "C" */
  2369. #endif
  2370.  
  2371. #include <poppack.h>
  2372.  
  2373. #endif /* #ifndef _DMUSICF_ */
  2374.